This content has been marked as final.
Show 5 replies
-
1. Re: RESTEasy in Seam and lazy-loading exceptions
christian.bauer Aug 17, 2009 12:08 PM (in response to fromage)Use a SMPC scoped to the conversation.
-
2. Re: RESTEasy in Seam and lazy-loading exceptions
lvdberg Aug 17, 2009 12:30 PM (in response to fromage)Your collection are annotated to be klazy loaded, so it will basically do a query for each collection. To get a more reliable (without the lazy-loading error ) AND efficient rest-service you should fetch-load your collections in your query.
-
3. Re: RESTEasy in Seam and lazy-loading exceptions
fromage Aug 17, 2009 1:28 PM (in response to fromage)My DAO:
@Stateless @Name("userDAO") public class UserDAOBean implements UserDAO { @PersistenceContext private EntityManager entityManager; public List<User> getUsers() { return entityManager.createQuery("FROM User ORDER BY id").getResultList(); } }
With this in components.xml:
<persistence:managed-persistence-context auto-create="true" name="entityManager"> <persistence:persistence-unit-jndi-name>java:/lipsEntityManagerFactory</persistence:persistence-unit-jndi-name> </persistence:managed-persistence-context>
Does this not make it a seam managed persistence context? How can I tie it to the conversation then?
-
4. Re: RESTEasy in Seam and lazy-loading exceptions
christian.bauer Aug 17, 2009 1:32 PM (in response to fromage)
Stephane Epardaud wrote on Aug 17, 2009 13:28:
My DAO:@PersistenceContext private EntityManager entityManager;
That's a PC managed by the EJB container. Seam-managed PC is injected through Seam with @In. This is documented extensively in the reference.
-
5. Re: RESTEasy in Seam and lazy-loading exceptions
fromage Aug 18, 2009 10:21 AM (in response to fromage)Aw man… how could I miss something like this. It's working now, thanks :)