portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Sean Taylor <da...@bluesunrise.com>
Subject OJB + Spring transactions broken
Date Thu, 09 Feb 2006 17:06:14 GMT
I tried writing a unit test to test OJB + Spring transactions.
To my suprise, transactions are not starting.

In fact, Im seeing some surprising results in mysql.log
(yes Im using InnoDB), note no transactions, and the forced autocommit

118 Query       SET autocommit=1
117 Prepare     [1] INSERT INTO FOLDER...
117 Execute     [1] INSERT INTO FOLDER... 		
117 Query       SET autocommit=1

It appears that OJB repeatedly sets autocommit=1
it never starts any transactions

Here is my unit test, which tests out a new 'fake' API addPage to the 
PageManager. This API is temporary to test transactional behavior:

public void testTx() throws Exception
         Folder root = pageManager.newFolder("/");
         Page[] pages = new Page[3];
         pages[0] = pageManager.newPage("/test1.psml");
         pages[1] = pageManager.newPage("/test2.psml");
         pages[2] = pageManager.newPage("/test3.psml");

In addPages, I try to force a rollback:

     public int addPages(Page[] pages)
     throws JetspeedException
         System.out.println("Adding first page");
         System.out.println("Adding second page");
         System.out.println("About to throw ex");
         throw new JetspeedException("Its gonna blow captain!");

Finally, add pages is enabled for a Spring tx:


To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org

View raw message