Re: Null field not persisted for Dates
On Feb 4, 2011, at 2:13 PM, Jerry Carter wrote: > Am I right is assuming that null values should be copies on merge? I've > reviewed the JPA 2.0 specification. I see that 3.2.7.1 does not disadvantage > null values >> If X is a detached entity, the state of X is copied onto a pre-existing >> managed entity instance X' of the same identity or a new managed copy X' of >> X is created. > > but note that 3.2.7.2 leaves some wiggle room for implementations supporting > lazy loading. I'm happy to file the report if this is a bug. > > I see that FetchType.EAGER is already specified (by default), so lazy loading > is already turned off for the field in question. Do I understand that > (post-merge), setting the value to null should cause the value to be > persisted? I completed an experiment which rules this option out. Looking at the value after the merge and after a flush, I can see that the null value is present in Java but that the database is not updated. Time to review the documentation for your other suggestion: > On Feb 4, 2011, at 1:56 PM, Rick Curtis [via OpenJPA] wrote: >> That would be the problem then. We lost track of the fact that you set this >> field to null, and assume that it wasn't loaded. Please review the >> openjpa.DetachState [1] docs for more info. You could set the property >> listed below so that we will stream our DetachedStateManager around. >> >> > value="fetch-groups(DetachedStateField=true)"/> >> >> [1] >> http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_detach_graph -- View this message in context: http://openjpa.208410.n2.nabble.com/Null-field-not-persisted-for-Dates-tp5993519p5997071.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
Unable to print Cache Statistics
I am using IBM RAD 7.5.x with IBM WAS 7.x so relying on the OpenJPA provided by WAS 7.x runtime. I suppose WAS 7.x is OpenJPA 2.x (right?) I have below configurations: persistence.xml ... ... Entity Code Snippet - ... @Entity @Table(name="LOOKUP_CODES") @DataCache(timeout=360) // 1hr public class LookupCodes implements Serializable { ... } As per above configuration I can see the Caching is enabled and working and I can also see Caching related log generated in my WAS server log files if I enable OpenJPA logging. The problem is I am not unable to print Cache Statistics using below code: EntityManagerFactory emf = (EntityManagerFactoryImpl)Persistence.createEntityManagerFactory("MyDomain"); OpenJPAEntityManagerFactory oemf = OpenJPAPersistence.cast(emf); StoreCache storeCache = oemf.getStoreCache(); boolean contains = storeCache.contains(LookupCodes.class, "7"); // this statement returns "false" and I wonder why? then I get below response: statistics.getReadCount():0 statistics.getHitCount():0 statistics.getWriteCount():0 statistics.getTotalReadCount():0 statistics.getTotalHitCount():0 statistics.getTotalWriteCount():0 statistics.getReadCount(LookupCodes.class)():0 statistics.getHitCount(LookupCodes.class):0 statistics.getWriteCount(LookupCodes.class):0 statistics.getTotalReadCount(LookupCodes.class)():0 statistics.getTotalHitCount(LookupCodes.class):0 statistics.getTotalWriteCount(LookupCodes.class):0 Even though the Caching is working and enabled, why am I not able to print the Cache statistics? Kindly request you to clarify. -- View this message in context: http://openjpa.208410.n2.nabble.com/Unable-to-print-Cache-Statistics-tp5995856p5995856.html Sent from the OpenJPA Users mailing list archive at Nabble.com.