将 as3 对象反序列化为 java 时。GraniteDS 抛出这个异常:
java.lang.ClassNotFoundException: org.hibernate.collection.PersistentSet
我认为一些依赖项应该在 pom.xml 中。有任何想法吗 ?
将 as3 对象反序列化为 java 时。GraniteDS 抛出这个异常:
java.lang.ClassNotFoundException: org.hibernate.collection.PersistentSet
我认为一些依赖项应该在 pom.xml 中。有任何想法吗 ?
经过调试,似乎graniteDS(版本:3.1.0.GA)提出了这个类作为外化器
org.granite.hibernate.HibernateExternalizer
这取决于休眠依赖项:
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;
这些依赖项在休眠版本(3.X)中是可以的。但是包命名空间在 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;
作为一种解决方法:我们可以使用相同的实现 HibernateExternalizer 定义我们的 owen externalizer 并更改导入。然后我们在 granite-config.xml 中使用这个自定义的外部化器。
希望 graniteDS 将那里的实现与外部依赖项解耦,这可能会产生如下的重大变化。
在序列化/反序列化时,除了原始类型和集合之外,GraniteDS 对休眠/任何 pojo 一无所知。因此,在您的情况下,即使库已到位,org.hibernate.collection.PersistentSet
Granite 也不会查找它。
解决方案:
为使用 int graniteDS 创建一个休眠对象的副本,因此您将拥有一个用于发送 AMF 对象的版本和另一个用于处理休眠的版本。此外,最好有两份副本。