-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Caveatemptor GenericEJB3DAO / Seam doubt
PostPosted: Mon Dec 14, 2009 10:28 am 
Newbie

Joined: Tue Jun 23, 2009 7:59 am
Posts: 6
Hello!

Looking at the Caveatemptor JPA example I didn't understand one thing:

The comment says: "If this DAO is wired in as a Seam component, Seam injects the right persistence context if a method on this DAO is called."

GenericEJB3DAO.java:
Code:
...
// If this DAO is wired in as a Seam component, Seam injects the right persistence context
// if a method on this DAO is called. If the caller is a conversational stateful component,
// the persistence context will be scoped to the conversation, not to the method call.
// You can call this method and set the EntityManager manually, in an integration test.
   
@PersistenceContext
public void setEntityManager(EntityManager em) {
    this.em = em;
}
...


As far as I understand it means that the DAO has to be a Seam component itself. But, if so, why can I use the annotation @PersistenceContext instead @In? I thought when the persistence is Seam-managed I had to use the @In annotation.

Maybe I understood wrong. I wonder what would happens if I have an instance of a DAO with a @PersistenceContext annotation in a Seam component. Would Seam handle the EntityManager reference or the EJB Container?

Thanks!
Luiz Filipe


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.