@PersistenceContext : JTA transaction support ?

21 views
Skip to first unread message

Mwi

unread,
Nov 24, 2010, 5:12:37 AM11/24/10
to guiceyfruit
Hi James,
in my sample below I currently pass a container-managed Entity Manager
via constructor to MyDao. Can I use guiceyfruit annotation
( @PersistenceContext) to inject a JTA enabled Entity Manager in
MyDAO ? Any hints are appreciated.
Thanks
Martin

@Stateless(name = "MySessionBean")
public class MySessionBean implements MyInterface {

@PersistenceContext(unitName = "PERSISTENCE_UNIT")
private EntityManager entityManager;
private MyDao dao;

@Override
MyTransferObject getData(int key) {
return dao.getData(key);
}

@PostConstruct
public void initialize() {
dao = new MyDao(entityManager);
}
}
Reply all
Reply to author
Forward
0 new messages