[hibernate-dev] Bytecode enhanced, Reference Cached immutable Entities

John O'Hara johara at redhat.com
Fri Mar 27 10:22:20 EDT 2015

I had been working on the assumption that the entity is mutable/immutable.

Is it possible for EntityEntry to be immutable? e.g. is it valid for 
states such as BooleanState.IS_BEING_REPLICATED or 
BooleanState.LOADED_WITH_LAZY_PROPERTIES_UNFETCHED to change during the 
lifetime of the EntityEntry object?

On 27/03/15 13:43, Steve Ebersole wrote:
> The only distinction we care about is EntityPetsister#isMutable.  The 
> read-only case should be handled by the normal MutableEntityEntry.  In 
> other words there is nothing to pass to EntityPersister to make a 
> decision based on; just getEntityEntryBuilder ().
> As far as LockMode, I think it makes the most sense to not do locking 
> for immutable entities.  Not sure if no-op or exception is the best 
> way to handle.  But regardless either way means we do not account for 
> locking for the immutable - entity EntityEntry.
> Which brings up another point.  We should decide whether the 
> mutable/immutable in these names refers to the fact that the entity is 
> mutable/immutable or refers to the state of the EntityEntry itself.  I 
> think it is best to agree on that semantic now before we potentially 
> start using these in situations they were not designed for.

John O'Hara
johara at redhat.com

JBoss, by Red Hat
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom.
Registered in UK and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (USA), Charlie Peters (USA), Matt Parsons (USA) and Michael O'Neill (Ireland).

More information about the hibernate-dev mailing list