0 Replies Latest reply on Apr 23, 2013 12:14 AM by Wooi Joe Chuah

    Best practices for DAOs?

    Wooi Joe Chuah Newbie

      Hi,

       

      I currently have an application which used to perform JNDI lookups to get access to the entityManagers used in DAO classes which are POJOs.

       

      Since this approach is already outdated, I was hoping someone could point me to any best practices regarding this issue.

       

      So far the few approaches I've found on the net are :

      1. @Stateless for each DAO to get access to entityManager using @PersistenceContext

      2. Pass the entityManager object from a SLSB(Stateless Session Bean) to the DAO pojo class

      3. Not use DAO classes at all and directly perform persistence in the service layer (not really an option in my case)

       

      I'm currently concerned about which approach is better in terms of performance and are there any standards to adhere to.

       

      Any help is greatly appreciated. Thanks