Ok, OK the answer is:

"Reread" the object and delet it in the "short" transaktion ;-)
Or does anybodya knows another way ?

Fredy

-----Urspr�ngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 2. M�rz 2004 22:02
An: [EMAIL PROTECTED]
Betreff: [castor-dev] QQL delete statement for long transaction


Hey all,
i should delete a object witch was read in a "long transaction"
I read the user with "getUser(..)" and transfer it to the client
And if the client want's to delete it, i call "deleteUser(...)"

The jdoHelper holds my database connection: jdoHelper.getDb()
See my previous popsting for this.

BaseVO is the base class of all my persistence objects !

The Error:
org.exolab.castor.jdo.oql.OQLSyntaxException: An incorrect token type
was found near Delete (found IDENTIFIER, but expected KEYWORD_SELECT)

But it's no select, its a delete ;-)))
Is there something like "executeUpdate" ??
How can i delete an object ?

Thanks
        Fredy


public UserJdo getUser(String email) throws PersistException
{
        UserJdo userJdo = null;
 
        try
        {                       
                StringBuffer buf = new StringBuffer();
                buf.append( "SELECT s FROM " );
                buf.append( UserJdoImpl.class.getName() );
                buf.append( " s WHERE strEmail=$1" );

                OQLQuery query = jdoHelper.getDb().getOQLQuery(
buf.toString() );
                        
                query.bind(email);
                        
                return (UserJdo)jdoHelper.executeBaseVO( query );
                        
        }
        catch (PersistenceException  e)
        {
                throw new PersistException(e);
        }
}


public BaseVO executeBaseVO(OQLQuery query) throws PersistenceException 
{
        db.begin();
        QueryResults results = query.execute();
        BaseVO baseVo = null;
        if( results.size() > 0 )                        
                baseVo = (BaseVO)results.next();
        db.commit();
        return baseVo;                  
}


public void deleteUser(String id) throws PersistException
{
        try
        {
                StringBuffer buf = new StringBuffer();
                buf.append( "Delete FROM " );
                buf.append( UserJdo.class.getName() );
                buf.append( " s WHERE id=$1" );
                        
                OQLQuery query = jdoHelper.getDb().getOQLQuery(
buf.toString() );
                        
                query.bind(id);
                                
                jdoHelper.executeBaseVO( query );
                
        }
        catch (PersistenceException e1)
        {
                // TODO Auto-generated catch block
                e1.printStackTrace();
        }
}


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

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



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.

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

Reply via email to