Hope I'm not posting this to the wrong forum. I raised this first on the EJB3 and
Hibernate user forums but have come to the conclusion it is a design / implementation
issue with EJB3/Hibernate.
I have a simple case of an entity which is read in one thread, then updated in another
thread using merge().
The Hibernate merge() code always reads the original value of a detached entity. From
DefaultMergeEventListener.entityIsDetached():
| //we must clone embedded composite identifiers, or
| //we will get back the same instance that we pass in
| final Serializable clonedIdentifier = (Serializable) persister.getIdentifierType()
| .deepCopy( id, source.getEntityMode(), source.getFactory() );
| final Object result = source.get(entityName, clonedIdentifier);
|
It should be possible to update the entity without the original value of the entity being
read from the DB. This is causing an unncecessary call to the DB.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991824#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...