persist « DAO « JPA Q&A

1. JPA: How to create a DAO class?

I design a DAO class this way :

public void Class(Class object){

    EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("persistUnit");
    EntityManager entityManager = entityManagerFactory.createEntityManager();


2. Persistent Objects and DAOs

Hi, Straight to the problem ... Should a Persistent/Domain/Business Object call a method of a DAO object passing to it another Persistent object as an argument or not? The question is in the context of an application arhitecture consisting of a DAO layer, Domain Model Layer, perhaps Service layer and UI. I have been reading this thread for several times ...

3. Hibernate annotations, DAO and persistence

Hello everyone. Sorry for bothering with this question that, I'm sure, has a simple answer that I really cannot find out. I read articles over and over and still cannot find the answer. So I'm using Hibernate annotations and dao stuff. Everything works perfectly: I can define beans with table information, declare relationships and collections etc. I created some classes to ...