Using Spring 3 + hibernate3 + c3p0 and hibernate transaction manager.
In the below I expect the data to be deleted and then inserted in one atomic transaction. The issue is that another process reading the data (using C2 method readAll) between the delete and insert times sees no data.
Code:=============== class C1 { <= C1 is injected into Main : this is a Java Application private C2 c2; <= injected @Transactional(value="myTransactionManager", isolation= Isolation.SERIALIZABLE, propagation= Propagation.REQUIRES_NEW) private m1(List l) { c2.deleteAll(); c2.insertList(l); } } =============== @Transactional(value="myTransactionManager", isolation= Isolation.SERIALIZABLE, propagation= Propagation.REQUIRED) class C2 { // has a DAO that uses C3P0 connection pool to mysql // method deleteAll()... // method insertList()... // method readAll()... }


Reply With Quote
