我是 orientdb 的新手,我正在尝试在数据库中保存一些实体,但我一直遇到这个异常:
GRAVE: Error on creating object of class SessionStats
java.lang.ClassCastException: com.heavenize.embedder.statsengine.model.SessionStats_$$_javassist_0 cannot be cast to javassist.util.proxy.Proxy
at com.orientechnologies.orient.object.enhancement.OObjectEntityEnhancer.getProxiedInstance(OObjectEntityEnhancer.java:155)
at com.orientechnologies.orient.object.db.OObjectDatabaseTx.newInstance(OObjectDatabaseTx.java:132)
at com.orientechnologies.orient.object.db.OObjectDatabaseTx.newInstance(OObjectDatabaseTx.java:92)
....
我已经使用对象数据库来保存一些对象,并且我创建了一个类来包装OObjectDatabaseTx
该类。
当我尝试创建新实例时发生异常。
public class DbOrientService
{
public <T> T newIntance(Class<T> instance)
{
OObjectDatabaseTx currentDbInstance = getCurrentDbInstance();
T newInstance = currentDbInstance.newInstance(instance); //Happens in this line
return newInstance;
}
public OObjectDatabaseTx getCurrentDbInstance()
{
this.db = new OObjectDatabaseTx(url);
if (!this.db.exist())
{
this.db = db.create();
}
else
{
this.db = OObjectDatabasePool.global().acquire(url, "admin", "admin");
}
return db;
}
我还注册了存储实体的包。我怎么解决这个问题?