Any error happens during commit() will cause the transaction to be rollback() automatically. It is expected.

 

Your catch clause call rollback() again, after it was done automatically. It is why TransactionNotInProgressException is thrown.

 

It is not a Castor problem.

 

 

 

 

Thomas

 

 

-----Original Message-----

>From: yangj [mailto:[EMAIL PROTECTED]]

>Sent: Monday, December 03, 2001 11:59 PM

>To: [EMAIL PROTECTED]

>Subject: Re: [castor-dev] Transaction Problem

>

>I test it using the latest code from CVS.

>The test case is very simple:

>When I update  a data with null which DB  do not permit null. So when commit is called SQL Exception happened, Then rollback is called , At that time TransactionNotInProgressException rise out.

>I think it is just db can not  be updated error, call rollback it sould not create out Exception.

>soruce and log are following.

>SRC:

>        try{

>        try {

>            CastorManager.initCastorManager();

>            db = CastorManager.getInstance().getJDO().getDatabase();

>            System.out.println("Begin");

>           String oql="select c from cn.com.daidoh.prod.Test c ";

>            Test accs=null;

> 

>            QueryResults results = null;

> 

>            OQLQuery accsOql = null;

>            accsOql = db.getOQLQuery(oql);

> 

>            db.begin();

>            results = Test.getResults(db);

>            if(results.hasMore()){

>                System.out.println("Accssary"+" has exist") ;

>                accs=(Test)results.next();

>                accs.userID=null;  <<--ERROR

> 

>            }

>            System.out.println("begin commit");

>59:            db.commit();

> 

>        }catch (Exception e) {

>            e.printStackTrace();

>            System.out.println("begin rollback");

>64:            db.rollback();

> 

>            System.out.println("Error");

>        }

>        }catch(Exception e){

>            e.printStackTrace();

>        }

>Log:

>java.sql.SQLException: ORA-01407: cannot update ("DAIDOH"."TEST"."USERID") to NULL

> 

>

> at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)

> 

> at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)

> 

> at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)

> 

> at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1451)

> 

> at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:862)

> 

> at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1839)

> 

> at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1764)

> 

> at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2354)

> 

> at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:421)

> 

> at com.codestudio.sql.PoolManPreparedStatement.executeUpdate(Unknown Source)

> 

> at org.exolab.castor.jdo.engine.SQLEngine.store(SQLEngine.java:843)

> 

> at org.exolab.castor.persist.ClassMolder.store(ClassMolder.java:1579)

> 

>begin rollback

> 

> at org.exolab.castor.persist.LockEngine.store(LockEngine.java:758)

> 

> at org.exolab.castor.persist.TransactionContext.prepare(TransactionContext.java:1438)

> 

> at org.exolab.castor.jdo.engine.DatabaseImpl.commit(DatabaseImpl.java:499)

> 

> at cn.com.daidoh.prod.Test.main(Test.java:59)  

>org.exolab.castor.jdo.TransactionNotInProgressException: This transaction is not open

> 

> at org.exolab.castor.jdo.engine.DatabaseImpl.rollback(DatabaseImpl.java:522)

> 

> at cn.com.daidoh.prod.Test.main(Test.java:64)

> 

> 

>----- Original Message -----

>From: "Bruce Snyder" <[EMAIL PROTECTED]>

>To: <[EMAIL PROTECTED]>

>Sent: Tuesday, December 04, 2001 12:53 AM

>Subject: Re: [castor-dev] Transaction Problem

>

>> This one time, at band camp, yangj said:

>>

>> y >Yes .The same behavior  happened without using poolman

>>

>> Yangj,

>>

>> Are you using the latest code from CVS? Can you send me a test case

>> of what you're doing and I'll test it out and get back to you?

>>

>> Thanks.

>>

>> --

>>

>> perl -e 'print unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'

>>

>> -----------------------------------------------------------

>> If you wish to unsubscribe from this mailing, send mail to

>> [EMAIL PROTECTED] with a subject of:

>> unsubscribe castor-dev

>>

>

Reply via email to