[appengine-java] [JDO/SDK1.3.1] A bug around transaction

2010-02-15 Thread vori
Hi, I think it is a bug around transaction of JDO/SDK1.3.1.
It does not occurs with SDK1.3.0


Entity entityA = pm.getObjectById(Entity.class, "keyA");
entityA.setDoubleProperty(Math.random());

tx = pm.currentTransaction();
tx.begin();

// This makePersistent throws "javax.jdo.JDOException:
// can't operate on multiple entity groups in a single
// transaction.", if any properties of the entity gotten
// via getObjectById was updated.
pm.makePersistent(new Entity("keyB"));
if(tx.isActive()) tx.commit();
-

Full source code is here.
 - http://code.google.com/p/test-gae-j-sdk-131/

Compiled application is deployed on here.
 - http://test4sdk131.appspot.com/

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



[appengine-java] Re: App Engine SDK 1.3.1 is out!

2010-02-12 Thread vori
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  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 entities = new ArrayList(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)" 
> 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  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 > >  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.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: App Engine SDK 1.3.1 is out!

2010-02-11 Thread vori
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 entities = new ArrayList(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)" 
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  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 > 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.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: App Engine SDK 1.3.1 is out!

2010-02-11 Thread vori
On 2月11日, 午後4:35, yjun hu  wrote:
> it exists on sdk1.3.0 too.

That code have worked well with 1.3.0.
I had updated SDK from 1.3.0 to 1.3.1, then the Exception occurred.
After that, I changed back to 1.3.0 and re-deploy, then the Exception
stopped.
(Of course I used the same source code.)

So, I think it is a bug of 1.3.1.
Or, is it a bug of 1.3.0?

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



[appengine-java] Re: App Engine SDK 1.3.1 is out!

2010-02-10 Thread vori
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.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.