The behavior is even more strange as I thought:

This code works:
================

        _db.begin();

>       OQLQuery oqlQuery = "SELECT obj from myclass obj" ;
        QueryResults results;
        oqlQuery = db.getOQLQuery( query );
        results = oqlQuery.execute();
        
        while (results.hasMore() ) {
            Object o = results.next() ;
            db.update( o );
            db.remove( o );
        }

        _db.commit();


This code does not work:
========================


        _db.begin();

>       OQLQuery oqlQuery = "SELECT obj from myclass obj" ;
        QueryResults results;
        oqlQuery = db.getOQLQuery( query );
        results = oqlQuery.execute();
        
        while (results.hasMore() ) {
            Object o = results.next() ;
//          db.update( o );
            db.remove( o );    // << here the exception occurrs
        }

        _db.commit();

> The exception:
> ==============
> 
> The object of type myclass is not persistent -- it was not queried or
> created within this transaction
> org.exolab.castor.jdo.ObjectNotPersistentException: The object of type
> myclass is not persistent -- it was not queried or created within this
> transaction
>         at 
>org.exolab.castor.persist.TransactionContext.delete(TransactionContext.java:1086)
>         at org.exolab.castor.jdo.engine.DatabaseImpl.remove(DatabaseImpl.java:380)
> 
> The question:
> =============
> 
> What's that ??? The object to be removed was obviously queried within
> the same transaction.
> 

-- 
Holger Krug
[EMAIL PROTECTED]

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to