[Hibernate-JIRA] Created: (HHH-2907) ability to apply 'generation strategy' to generated properties
by Steve Ebersole (JIRA)
ability to apply 'generation strategy' to generated properties
--------------------------------------------------------------
Key: HHH-2907
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2907
Project: Hibernate3
Issue Type: New Feature
Components: core
Reporter: Steve Ebersole
Assignee: Steve Ebersole
Priority: Minor
Fix For: 3.3
Currently, the support for generated properties allows only for db-generated values (ala triggers etc). Would be great to allow the user to provide a seperate (optional) strategy for generating the generated values.
It would be nice to have a generic solution, which we can build on top of for the more common use cases. Also, we may need to use a name other than 'generated' in the annotations to avoid conflicts with the current @Generated annotation; for now lets use the term @Dynamic.
Consider mapping a 'created timestamp' column. Currently, provided we are using a trigger, that would look like:
@Generated(INSERT) Date created;
The strategy here (^^) is implicitly 'db', as the db is taking care of the generation. In the most generic form, that could be written as:
@Dynamic(time=INSERT,strategy=DB) Date created;
Additionally, since this is such a common case, also allow this:
@CreationTimestamp Date created;
The final form would also allow the definition of strategies. As an example, consider:
@CreationTimestamp(strategy=NOW) Date created;
Here we are not relying on the db to generate the value, but are explicitly telling Hibernate to do it (basically 'use the current timestamp to generate a value here whenever we do an insert').
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years
[Hibernate-JIRA] Created: (HHH-5599) NPE occurs when using Infinispan as L2 Cache
by Chris (JIRA)
NPE occurs when using Infinispan as L2 Cache
--------------------------------------------
Key: HHH-5599
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5599
Project: Hibernate Core
Issue Type: Bug
Components: caching (L2)
Affects Versions: 3.5.6, 3.5.5
Environment: Hib 3.5.6
Infinispan 4.2.0.ALPHA2
(same thing happen with Hib 3.5.5 and IS 4.1.0.FINAL)
Reporter: Chris
Priority: Critical
Pretty much randomly or so it seems, infinispan hibernate layer will throw a NPE. It occurs a lot when the j2EE server is started and overtime (once caches are warmer?) diminish.
The issue comes from the PutFromLoadValidator.Java(565).The cleaned element is null and the map.put(cleaned) fails since the key is coming from the cleaned element (cleaned.owner).
Complete stacktraces, the first on entity loading and the later on collection loading:
Cause: java.lang.NullPointerException
at org.hibernate.cache.infinispan.access.PutFromLoadValidator$PendingPut.access$700(PutFromLoadValidator.java:674)
at org.hibernate.cache.infinispan.access.PutFromLoadValidator$PendingPutMap.put(PutFromLoadValidator.java:627)
at org.hibernate.cache.infinispan.access.PutFromLoadValidator.cleanOutdatedPendingPuts(PutFromLoadValidator.java:565)
at org.hibernate.cache.infinispan.access.PutFromLoadValidator.preventOutdatedPendingPuts(PutFromLoadValidator.java:493)
at org.hibernate.cache.infinispan.access.PutFromLoadValidator.registerPendingPut(PutFromLoadValidator.java:438)
at org.hibernate.cache.infinispan.access.TransactionalAccessDelegate.get(TransactionalAccessDelegate.java:66)
at org.hibernate.cache.infinispan.entity.TransactionalAccess.get(TransactionalAccess.java:36)
at org.hibernate.engine.BatchFetchQueue.isCached(BatchFetchQueue.java:278)
at org.hibernate.engine.BatchFetchQueue.getEntityBatch(BatchFetchQueue.java:253)
at org.hibernate.loader.entity.BatchingEntityLoader.load(BatchingEntityLoader.java:90)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3270)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:496)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:477)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:285)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:152)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1080)
at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1028)
at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:623)
at org.hibernate.type.EntityType.resolve(EntityType.java:431)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:140)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:898)
at org.hibernate.loader.Loader.doQuery(Loader.java:773)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
at org.hibernate.loader.Loader.loadEntityBatch(Loader.java:2047)
at org.hibernate.loader.entity.BatchingEntityLoader.load(BatchingEntityLoader.java:99)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3270)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:496)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:477)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:285)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:152)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1080)
at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1028)
at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:623)
at org.hibernate.type.EntityType.resolve(EntityType.java:431)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:140)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:898)
at org.hibernate.loader.Loader.doQuery(Loader.java:773)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
at org.hibernate.loader.Loader.doList(Loader.java:2449)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2192)
at org.hibernate.loader.Loader.list(Loader.java:2187)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:452)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1258)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
Cause: java.lang.NullPointerException
at org.hibernate.cache.infinispan.access.PutFromLoadValidator$PendingPut.access$700(PutFromLoadValidator.java:674)
at org.hibernate.cache.infinispan.access.PutFromLoadValidator$PendingPutMap.put(PutFromLoadValidator.java:627)
at org.hibernate.cache.infinispan.access.PutFromLoadValidator.cleanOutdatedPendingPuts(PutFromLoadValidator.java:565)
at org.hibernate.cache.infinispan.access.PutFromLoadValidator.preventOutdatedPendingPuts(PutFromLoadValidator.java:493)
at org.hibernate.cache.infinispan.access.PutFromLoadValidator.registerPendingPut(PutFromLoadValidator.java:438)
at org.hibernate.cache.infinispan.access.TransactionalAccessDelegate.get(TransactionalAccessDelegate.java:66)
at org.hibernate.cache.infinispan.collection.TransactionalAccess.get(TransactionalAccess.java:36)
at org.hibernate.engine.BatchFetchQueue.isCached(BatchFetchQueue.java:295)
at org.hibernate.engine.BatchFetchQueue.getCollectionBatch(BatchFetchQueue.java:203)
at org.hibernate.loader.collection.BatchingCollectionInitializer.initialize(BatchingCollectionInitializer.java:73)
at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:628)
at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:83)
at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1853)
at org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:479)
at org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:899)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:275)
at org.hibernate.loader.Loader.doList(Loader.java:2449)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2192)
at org.hibernate.loader.Loader.list(Loader.java:2187)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:452)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1258)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
For now I am masking this class with my own which essentially is a copy and paste but added a null check before trying to put back the element.
How the big question is : Is it normal that the element can be null and it's a simple null check that has been forgotten or the element should never be null and something bigger is going on ?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years