Does your application work if you don't detach the entity a second time? For instance, are you able to update the entity, re-cache it, then retrieve it and pass it back into makePersistent without any errors? I was under the impression that passing an entity into makePersistent re-attaches the entity, but it's also possible that you don't need to explicitly detach it more than once.
- Jason On Tue, Jan 12, 2010 at 7:15 AM, Prashant Gupta <[email protected]>wrote: > Hi, > > Here is my doubt... > > Suppose I created a new Entity : Entity ety = new Entity(); > Created a new persistent manager and made it persistent : > pm.makePersisent(ety); > Detached it and cached to memcache : cache.put("myentity", > pm.detachCopy(ety)); > pm.close(); > > now, in the same request or subsequent request, I need that entity again. > So, I picked it from memcache : Entity ety = cache.get("myentity"); > Made some changes : ety.doSomeChange(); > Opened a new persistent manager and persisted it : pm.makePersistent(ety); > Now I want to update memcache also : cache.put("myentity", * > pm.detachCopy(ety)*); // line 204 > pm.close(); > > Is it required to detach entity second time? While trying to detach is > second time I am getting following exception; > > javax.jdo.JDOUserException: Object of type "xyz.Entity" and identity "ety" > was not detached correctly. Please consult the log for any possible > information. > at > org.datanucleus.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:375) > at > org.datanucleus.jdo.JDOPersistenceManager.jdoDetachCopy(JDOPersistenceManager.java:1110) > at > org.datanucleus.jdo.JDOPersistenceManager.detachCopy(JDOPersistenceManager.java:1134) > at HelperClass.makePersistent(HelperClass.java:204) > ..... > > I am not able to point out any other reason for this exception. > > Following is my Entity Class : > > @PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = > "true") > public class Entity implements Serializable{ > > @SuppressWarnings("unused") > @Persistent(primaryKey = "true") > private String ID; > > @Persistent > private String Version; > > @Persistent > private Boolean Enabled; > @Persistent > private Date TimeStamp; > @Persistent > private LinkedList<Key> Permissions; > @SuppressWarnings("unused") > @Persistent > private ModuleType Type; // ModuleType is an Enum Type > > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-appengine-java%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > >--
You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
