users@glassfish.java.net

Check scope of entity - managed or unmanaged ?

From: <glassfish_at_javadesktop.org>
Date: Thu, 24 Jul 2008 06:02:10 PDT

Hi,

i would like to create a toString entity method returning some fields from the
entity bean. inside the container, all works fine, but if i return the entity to the client,
outside the container (entity unmanaged), i got an org.hibernate.LazyInitializationException
exception, because the field is lot "touched" inside the container - this is ok.

Can i check in the Entity.toString method, if the entity is managed (inside container) or
unmanaged (outside container) to avoid this LAZY-exception ?

regards
Danny
[Message sent by forum member 'danny70437' (danny70437)]

http://forums.java.net/jive/thread.jspa?messageID=289022