Thanks for making the code available.  This looks like an unintentional bug
fix to me.  There is a hard and fast rule that you can't operate on more
than one entity group inside a transaction, so creating and saving two
instances of EntityA should always generate an exception because they are
both root entities and therefore part of different entity groups.  This code
_should_ have thrown an exception in 1.3.0 (and earlier), but it didn't.  I
made some implementation changes to how transactions are managed in 1.3.1
and it looks like I fixed this problem as part of it.

Max

On Fri, Feb 12, 2010 at 12:10 AM, vori <vori...@gmail.com> wrote:

> The following source code has the same problem.
>
> ---------
> PersistenceManager pm = pmfInstance.getPersistenceManager();
>
> pm.makePersistent(new EntityB("key"));  // If this two lines are
> commented out,
> pm.getObjectById(EntityB.class, "key"); // the following code throws
> exception on sdk1.3.0 too.
>
> Transaction tx = pm.currentTransaction();
> tx.begin();
> pm.makePersistent(new EntityA());
> pm.makePersistent(new EntityA()); // it throws exception if it
> compiled using sdk1.3.1.
> tx.commit();
> ---------
>
> Full source code is included in the following repository.
> Hg repo
> https://test-gae-j-sdk-131.googlecode.com/hg/
> Project page: http://code.google.com/p/test-gae-j-sdk-131/
>
> On 2月12日, 午後4:25, vori <vori...@gmail.com> wrote:
> > Sorry, I am wrong.
> > I inspected my source code and found the real cause.
> >
> > The following code can works on SDK1.3.0, but it throws
> > "java.lang.IllegalArgumentException:
> >  can't operate on multiple entity groups in a single transaction."
> > when it used on SDK1.3.1.
> >
> > ----
> > PersistenceManager pm = pmfInstance.getPersistenceManager();
> >
> > pm.makePersistent(new EntityB("key"));  // If this two lines are
> > commented out,
> > pm.getObjectById(EntityB.class, "key"); // the following code throws
> > exception on SDK1.3.0 too.
> >
> > ArrayList<EntityA> entities = new ArrayList<EntityA>(2);
> > entities.add(new EntityA());
> > entities.add(new EntityA());
> > Transaction tx = pm.currentTransaction();
> > tx.begin();
> > pm.makePersistentAll(entities); // it throws exception if it compiled
> > using sdk1.3.1.
> > tx.commit();
> > ----
> >
> > Full source code is here.https://test-gae-j-sdk-131.googlecode.com/hg/
> >
> > On 2月12日, 午前3:11, "Max Ross (Google)" 
> > <maxr+appeng...@google.com<maxr%2bappeng...@google.com>
> >
> > wrote:
> >
> >
> >
> > > Assuming a ClassA object with the specified id already exists, the code
> > > you've posted works fine for me.  Could you put together a complete
> example
> > > that demonstrates the unexpected behavior?
> >
> > > Thanks,
> > > Max
> >
> > > On Wed, Feb 10, 2010 at 7:49 PM, vori <vori...@gmail.com> wrote:
> > > > Is it a bug on JDO of SDK 1.3.1?
> >
> > > > ------
> > > > PersistentManager pm = PMF.get().getPersistenceManager();;
> >
> > > > ClassA classA = pm.getObjectById(ClassA.class, "id");
> > > > ClassB classB = new ClassB();
> >
> > > > Transaction tx = pm.currentTransaction();
> > > > tx.begin();
> > > > pm.makePersistent(classB);
> >
> > > > tx.commit(); // It throws "javax.jdo.JDOException: can't operate on
> > > > multiple entity groups in a single transaction."
> > > > ------
> >
> > > > --
> > > > 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><google-appengine-java%2B
> unsubscr...@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<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