2 Replies Latest reply on Dec 12, 2006 3:06 AM by Gunnar Hilling

    EntityManager / Lazy Fetch / J2EE / Swing App

    knifegun Newbie

      I have a J2EE based application running on JBoss 4.0.5 EJB 3. I have a Swing client which uses a stateless session bean to retrieve data from the database via an Entity Manager. All the EJBs are set to LAZY fetch. When I try to access a child entry to a EJB (i.e. access the object representing the a row in another table), I get an error because the session is closed.

      Now I know this is because the EJB is detached since the EntityManger was loaded in the J2EE container and serialized to my Java Swing client.

      My question is, are there any recommended ways to still use LAZY fetching but be able to access children of a current entity bean? Any utility to reattach the EJB? Any best practice?


      Thanks!