users@glassfish.java.net

Difference between Hibernate and EclipseLink JPA

From: <forums_at_java.net>
Date: Tue, 12 Jul 2011 07:16:10 -0500 (CDT)

Sorry for my ugly English :-) Several months ago we started a new project.The
platform has been selected Glassfish + GWT(with Dozer&DTO)  We have not had
experience in similar projects and we are faced with the problem.   Our data
stuck in the EntityManager instance if we use EclipseLink as JPA provider,
For example :   @Entity class A {      @OneToMany    private List<B>
listOfB;   }   simple service   @Stateless SimpleService {    
@PersistenceContext EntityManager em;     public A test(){       // 1
Create new B object       B b = new B();       em.persist(b);      
// 2 Find existing object A       A a = em.find(A.class,123);       //
3 Adding b in collection OK I SEE CHANGES IN DATABASE      
a.listOfB.add(b);       em.persist(b);       // a.listOfB.size()  == 1
 !!!!!!!!!!       return a;   } }   and in RPC servlet f.e.     @EJB
SimpleService ss;   public void test(){     A a = ss.test();     
//////// IF HIBERNATE JPA PROVIDER - LazyIncializationException !!!! OK I SEE
    a.listOfB.size()   //////// IF ECLIPSELINK -  NO EXCEPTION BUT
a.listOfB.size() == 0 !!!!!!!!!!!! obsolette data in collection and ONLY
AFTER REDEPLOY i will see new data   a.listOfB.size()   }     why so
different approach??    
 


--
[Message sent by forum member 'moloco1977']
View Post: http://forums.java.net/node/821153