If you Robots do not share the same parent (or have no parent) then you cannot delete them in a single transaction.

On 10 Feb 2010, at 14:52, 杨浩 wrote:

Yes!

2010/2/10 Andrés Cerezo <[email protected]>
I don´t understand very well I think you are telling me:

Transaction tx = pm.currentTransaction();
// tx.begin(); old
Extent ex = pm.getExtent(Robot.class, true);
Iterator iter = ex.iterator();
while (iter.hasNext())
{
tx.begin(); // new
Robot obj = (Robot)iter.next();
pm.deletePersistent(obj);
tx.commit();
}

isn´t?

2010/2/10 杨浩 <[email protected]>:
> First it 's work ok!
> but after tx.commit() the transaction is complete,so you must call
> tx.begin() to start a transaction before tx.commit()!
>
> Or invoke the tx.commit out of the while block!
>
> I'm sorray for my English!
>
> 2010/2/10 Acerezo <[email protected]>
>>
>> Hello all, I can´t delete records of a table
>>
>> I'm using this code:
>>
>>  PersistenceManager pm =
>> PersistenceManagerHelper.getPersistenceManager();
>>
>> Transaction tx = pm.currentTransaction();
>> tx.begin();
>> Extent ex = pm.getExtent(Robot.class, true);
>> Iterator iter = ex.iterator();
>> while (iter.hasNext())
>> {
>> Robot obj = (Robot)iter.next();
>> pm.deletePersistent(obj);
>> tx.commit();
>> }
>>
>> And always delete only two records after I get this message in the
>> log:
>>
>> Transaction is not active. You either need to define a transaction
>> around this, or run your PersistenceManagerFactory with
>> 'NontransactionalRead' and 'NontransactionalWrite' set to 'true'
>>
>>
>> Anyone can help me, please?
>>
>> 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 [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.
>

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



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

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