Using JSF, JPA and DAO. Without Spring?
Posted
by ich-bin-drin
on Stack Overflow
See other posts from Stack Overflow
or by ich-bin-drin
Published on 2009-12-07T16:42:09Z
Indexed on
2010/04/17
17:43 UTC
Read the original article
Hit count: 272
Hi,
till now i still worked with JSF and JPA without DAOs. Now i'd like to use DAOs. But how can i initialize the EntityManager in the DAO-Classes?
public class AdresseHome {
@PersistenceContext
private EntityManager entityManager;
public void persist(Adresse transientInstance) {
log.debug("persisting Adresse instance");
try {
entityManager.persist(transientInstance);
log.debug("persist successful");
} catch (RuntimeException re) {
log.error("persist failed", re);
throw re;
}
}
}
Have I to use Spring or is there a solution that works without Spring?
Thanks.
© Stack Overflow or respective owner