You have to understand how a/the persistence context works. The persistence context is a
cache, basically an identity map that has as keys the primary keys of database rows, and
as values some Java instances. During one conversation, no matter how it it gets there
(find by identifier, query, lazy initialization), I have one persistence context and one
identity map.
You can manage a persistence context. The EntityManager API has clear() and the Hibernate
Session API also evict(o) for single instances.
You can load stuff into the persistence context any way you want, the important thing is
to keep the identity scope so that at most you have one in-memory representation of a
particular database row. Without this, you would work with detached objects, a totally
different concept that implies much more manual work.
Read this:
http://www.manning.com/bauer2
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3981044#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...