Here is my test case and with output :



@Override
        protected void doGet(HttpServletRequest req, HttpServletResponse
resp) throws IOException {
                PrintWriter out = resp.getWriter();
                out.println("debug here..." + new Date());
                
                TestEntity entity = new TestEntity();
                entity.setValues("test", "test again");
                entity.print("Before Persisting");
                
                PersistenceManager pm = pmf.getPersistenceManager();
                pm.makePersistent(entity);
                entity.print("After Persisting");
                entity = pm.detachCopy(entity);
                entity.print("After Detaching");
                pm.close();
        }


@PersistenceCapable(identityType = IdentityType.APPLICATION,
detachable = "true")
class TestEntity implements Serializable {
        
        @Persistent(primaryKey = "true")
        private String ID = "test";
        
        @Persistent
        private String Val;
        
        @NotPersistent
        private String Value;
        
        void setValues(String val, String value) {
                this.Val = val;
                this.Value = value;
        }
        
        void print(String str) {
                System.err.println(str + ": " + this.Val + ", " + this.Value);
        }
}



========= OUTPUT ==========
Before Persisting: test, test again
After Persisting: test, test again
After Detaching: test, null




why persistent manager removes non-persistent values after detaching a
PersistentCapable entity ?

-- 
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.

Reply via email to