Where do u commit the transaction? I hope it is not after saving of A. Could
you confirm if B and A are persisted and committed seperately and
independent of each other.

Thanks
Hari

On Jul 19, 2010 9:15 AM, "pbadn" <doug...@poweredbyalt.net> wrote:

I am having a problem that is confusing me.

I have two entities, A and B.  Both have user-assigned numeric ids and
A refers to an instance of B.  So I have a process like this:

B b = new B();
b.setId(1);

// save b

A a = new A();
a.setId(1);

B b2 = DAL.getBById(1);
a.setB(b2);

// save a

DAL.getBById is a method that returns an instance of B by the id given
to it.  However, when I do this, a second instance of B is created.
So I should have an instance of A and an instance of B that is
referred to by A.  But what I have is an instance of A and two
instances of B.
Is this a common mistake?  I am new to GAE/J and JDO.

Thanks!

--
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 google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to
google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2bunsubscr...@googlegroups.com>
.
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 google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to