0

When deserialising as3 object to java . GraniteDS throw this Exeption :

java.lang.ClassNotFoundException: org.hibernate.collection.PersistentSet

I think some dependencies should been in pom.xml . any ideas ?

Zeus
  • 6,386
  • 6
  • 54
  • 89
Sami Jmii
  • 460
  • 7
  • 17

2 Answers2

0

GraniteDS does not know anything about the hibernate/any pojos apart from the primitive types and collections when serializing/deserializing. So, in your case even though the library is in place org.hibernate.collection.PersistentSet Granite does not look for it.

Solution:

Create a copy of the hibernate objects for using int graniteDS, so you will have one version for sending the AMF objects and other one dealing with hibernate. Also, it is a good practice to have two copies.

Zeus
  • 6,386
  • 6
  • 54
  • 89
  • sorry , i didn't understand what you proposed . what do you mean by creating different copies ? – Sami Jmii Sep 22 '14 at 22:10
  • @SamiJmii Meaning, do not use the hibernate objects to send data to the UI. If you have Person object in Hibernate, create another object named Person in a different package but with same properties and use this object to send to the UI. – Zeus Sep 22 '14 at 23:04
  • ok , but this throwble (classe not found ) occurs when i send data from flex client to the server . it occurs somehow when deserializing my 'person' data to it's corresponding java type . my person data does not even have any collection data just primitive types . – Sami Jmii Sep 22 '14 at 23:16
0

After debugging , It seems graniteDS (version : 3.1.0.GA) proposes this class as externalizer

org.granite.hibernate.HibernateExternalizer

wich depend on hibernate dependencies :

import org.hibernate.collection.PersistentCollection;
import org.hibernate.collection.PersistentList;
import org.hibernate.collection.PersistentMap;
import org.hibernate.collection.PersistentSet;
import org.hibernate.collection.PersistentSortedMap;
import org.hibernate.collection.PersistentSortedSet;

those dependencies are ok in hibernate versions (3.X) . but the package namespace is no longer valide in hibernate 4 :

import org.hibernate.collection.internal.PersistentBag;
import org.hibernate.collection.internal.PersistentList;
import org.hibernate.collection.internal.PersistentMap;
import org.hibernate.collection.internal.PersistentSet;
import org.hibernate.collection.internal.PersistentSortedMap;
import org.hibernate.collection.internal.PersistentSortedSet;

as a work around : we could define our owen externalizer with the same implementation HibernateExternalizer and change the imports . then we use this custom externalizer in granite-config.xml .

Hoping that graniteDS decouple there implementation from external dependencies that could make breaking change as below .

Sami Jmii
  • 460
  • 7
  • 17