org.datanucleus.exceptions.NucleusUserException:对象管理器已关闭

joh*_*999 1 google-app-engine jdo

我收到以下错误消息:

org.datanucleus.exceptions.NucleusUserException:对象管理器已关闭

我已经阅读了我能找到的所有内容,但我仍然不明白是什么导致了它.如果我无法解决这个简单的问题,我即将放弃并切换到SQL DB.是的我关闭了下午:

static void persistAll(Object [] objs){

PersistenceManager pm = PMF.get().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
  tx.begin();
  for (Object o : objs)
    pm.makePersistent(o);
  //pm.makePersistentAll(objs);
  tx.commit();
} finally {
  if (tx.isActive())
    tx.rollback();
  pm.close();
}
Run Code Online (Sandbox Code Playgroud)

}

我已经把我的东西拆开了,我已经把我的物品分开了.我现在能做什么???我完全坚持这一个!!! DataNucleus,请帮忙!!!

JG

我已经尝试将Store的List <>字段添加到默认的fetch组中,在调试我的应用程序时,我从Jetty收到以下警告错误.当我拿东西时,我将不得不尝试"触摸"字段.(?)

Jan 29, 2012 1:29:30 PM org.datanucleus.store.appengine.MetaDataValidator warn
WARNING: Meta-data warning for com.foobar.foo.Store.sales: The datastore does not support joins and therefore cannot honor requests to place related objects in the default fetch group.  The field will be fetched lazily on first access.  You can modify this warning by setting the datanucleus.appengine.ignorableMetaDataBehavior property in your config.  A value of NONE will silence the warning.  A value of ERROR will turn the warning into an exception.
Jan 29, 2012 1:29:30 PM org.datanucleus.store.appengine.MetaDataValidator warn
WARNING: Meta-data warning for com.foobar.foo.Store.shipments: The datastore does not support joins and therefore cannot honor requests to place related objects in the default fetch group.  The field will be fetched lazily on first access.  You can modify this warning by setting the datanucleus.appengine.ignorableMetaDataBehavior property in your config.  A value of NONE will silence the warning.  A value of ERROR will turn the warning into an exception.
Jan 29, 2012 1:29:30 PM org.datanucleus.store.appengine.MetaDataValidator warn
WARNING: Meta-data warning for com.foobar.foo.Store.users: The datastore does not support joins and therefore cannot honor requests to place related objects in the default fetch group.  The field will be fetched lazily on first access.  You can modify this warning by setting the datanucleus.appengine.ignorableMetaDataBehavior property in your config.  A value of NONE will silence the warning.  A value of ERROR will turn the warning into an exception.
Run Code Online (Sandbox Code Playgroud)

我得到一个NullPointerException来自pm.makePersistent(store)即使我跟那家商店不为空调试检查(但由于默认提取组无法正常工作,可能是其中的一些子域都为空的不知何故(?)

Amy*_* U. 5

我怀疑你的问题与试图访问延迟加载的字段的值有关.如果在PersistenceManager关闭后执行此操作,则会出错.例如,延迟加载是JDO拥有的关系中子对象的默认值.确保在关闭pm并分离对象之前获取或访问("触摸")此类内容.使用拥有的一对一关系,您还可以将子字段添加到"默认提取组",以便检索并加载父级.

这里有更多关于此的讨论:http://code.google.com/appengine/docs/java/datastore/jdo/relationships.html#Owned_One_to_One_Relationships