[seam-dev] [seam-persistence] ManagedPersistenceContextExtension

Emmanuel Bernard emmanuel at hibernate.org
Mon Jul 11 07:24:26 EDT 2011


On 11 juil. 2011, at 10:46, Mark Struberg wrote:

> Ok txs. This means Hibernate must load all properties of an entity in a very eager way. Even ElementCollections and blobs, right?
> 
> Otherwise you cannot distinguish between 
> 
> *) field is null because the blob didn't get loaded yet (_loaded==false)
> *) field is null because it got set to null to clear it (_loaded==true, _dirty==true)

That's not correct.
Hibernate keeps the loaded state in the PersistenceContext, not on the entities themselves. We use Proxies attached to the PC for association boundaries that are not loaded. We use implementation of collections for to many associations.
(Non association) property lazyness is achieved by bytecode enhancement but nobody uses this feature pretty much it's mostly a marketing driven one.

> 
> The _dirty is not that important (only can help to improve performance), but it would be fine if the JPA spec could introduce a 
> 
> @Loaded
> private BitField _loaded;

There are contracts in PersistenceUtil to check for this status.


More information about the seam-dev mailing list