Hibernate serialization exception in GWT but Eclipselink not

I am using the Eclipselink JPA (Entity) implementation with a GWT 2.0 framework at the presentation level. Everything is working fine. But when I change my JPA implementation to Hibernate, I get a Serialization / Deserialization Expression exception on the GWT Layer when I pass the beans object, but that's fine in Eclipelink JPA. What is really going on? Hibernate is an implementation of JPA and eclipselink, why do they act differently?

What should I do to resolve this exception in Hibernate? using hibernate4gwt?

Which JPA implementation is better for GWT?

Hi

+3
source share
2 answers

GWT Hibernate, , ( - ) "" GWT:

Hibernate ,

...

Hibernate, , . . Javassist - Hibernate. GWT RPC - , , , , , , RPT GWT , type is .

, loadAccounts(), RPC.invokeAndEncodeResponse(), , , a ArrayList java.util.Set org.hibernate.collection.PersistentSet.

, JDO JPA, Google App Engine.

...

, , Hibernate, JPA, EclipseLink if ( , , ).

, :

, .

...

-, , GWT "" JPA, . , EclipseLink . - , , .

-, " " JPA, Hibernate - JPA, Gilead ( OpenJPA EclipseLink ).

:)

.

+6

: .

: MyClass , One To Many YourClass:

public class MyClass implements Serializable {

    private List<YourClass> yourClassList;

    @OneToMany(mappedBy="myClass")
    public List<YourClass> getYourClassList {
        return yourClassList;
    }
}

Hibernate , , PersistentBag, , . GWT . .

public class MyClass_CustomFieldSerializer {
   public serialize(SerializationStreamWriter writer, MyClass instance) throws SerializationException {
       writer.write(new ArrayList<YourClass>(instance.getYourClassList());
   }
}

, Gilead/Dozer/ .

0

Source: https://habr.com/ru/post/1757834/


All Articles