-
1. Re: Single call commits a dozen times.
komone Aug 10, 2004 11:54 AM (in response to komone)I probably should have mentioned it's a CMR table, and using hsqldb. But it seems that JBoss commits a bazillion times after any entity activity.
/k1 -
2. Re: Single call commits a dozen times.
komone Aug 11, 2004 11:10 AM (in response to komone)LOL.
I take the answer would be one of:
1) You idiot.
2) Look at the source code.
3) Better that than not committing the update at all.
/k1 -
3. Re: Single call commits a dozen times.
aloubyansky Aug 12, 2004 8:39 AM (in response to komone)I am also curious...
final long startTime = System.currentTimeMillis(); log.debug("RUN>"); final DLocalHome dh = DUtil.getLocalHome(); CLocal c = CUtil.getLocalHome().create(new Long(1)); for(int i = 1; i < 5; ++i) { dh.create(new Long(i), new Long(i), "name" + i).getC().add(c); } log.debug("RUN> done in " + (System.currentTimeMillis() - startTime) + " ms.");
2004-08-12 15:34:08,908 DEBUG [org.jboss.test.cmp2.advanced.ejb.FacadeSessionBean] RUN> 2004-08-12 15:34:08,908 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.C] Executing SQL: SELECT COUNT(*) FROM C WHERE id=? 2004-08-12 15:34:08,918 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.C] Executing SQL: INSERT INTO C (id, firstName, lastName, a_id, b_name, b_id) VALUES (?, ?, ?, ?, ?, ?) 2004-08-12 15:34:08,928 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.D] Executing SQL: SELECT COUNT(*) FROM D WHERE id=? AND id2=? 2004-08-12 15:34:08,928 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.D] Executing SQL: INSERT INTO D (id, id2, firstName, lastName) VALUES (?, ?, ?, ?) 2004-08-12 15:34:08,968 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.D] Executing SQL: SELECT COUNT(*) FROM D WHERE id=? AND id2=? 2004-08-12 15:34:08,968 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.D] Executing SQL: INSERT INTO D (id, id2, firstName, lastName) VALUES (?, ?, ?, ?) 2004-08-12 15:34:08,978 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.D] Executing SQL: SELECT COUNT(*) FROM D WHERE id=? AND id2=? 2004-08-12 15:34:08,978 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.D] Executing SQL: INSERT INTO D (id, id2, firstName, lastName) VALUES (?, ?, ?, ?) 2004-08-12 15:34:08,978 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.D] Executing SQL: SELECT COUNT(*) FROM D WHERE id=? AND id2=? 2004-08-12 15:34:08,988 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.D] Executing SQL: INSERT INTO D (id, id2, firstName, lastName) VALUES (?, ?, ?, ?) 2004-08-12 15:34:08,988 DEBUG [org.jboss.test.cmp2.advanced.ejb.FacadeSessionBean] RUN> done in 80 ms. 2004-08-12 15:34:08,988 DEBUG [org.jboss.test.cmp2.advanced.ejb.CBean] 1.ejbStore 2004-08-12 15:34:08,988 DEBUG [org.jboss.test.cmp2.advanced.ejb.DBean] [.1.1.]> EJB STORE 2004-08-12 15:34:08,988 DEBUG [org.jboss.test.cmp2.advanced.ejb.DBean] [.2.2.]> EJB STORE 2004-08-12 15:34:08,988 DEBUG [org.jboss.test.cmp2.advanced.ejb.DBean] [.3.3.]> EJB STORE 2004-08-12 15:34:08,988 DEBUG [org.jboss.test.cmp2.advanced.ejb.DBean] [.4.4.]> EJB STORE 2004-08-12 15:34:08,988 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCInsertRelationsCommand.C] Executing SQL: INSERT INTO C_D(C_FK, D_FK, D2_FK) VALUES (?, ?, ?) 2004-08-12 15:34:08,998 INFO [STDOUT] COMMIT
-
4. Re: Single call commits a dozen times.
komone Aug 13, 2004 11:51 AM (in response to komone)Thank you very much for your answer, Alexey.
My server debug log shows pretty much the same as yours (obviously without the stdout commit line).
I was monitoring hsqldb by watching the *.script file from the data directory whilst exercising the application. That's where I continually saw the multiple commits. I guess it's quite possible that it's a hypersonic thing, rather than jboss (though I've not seen it before).
In the first instance, I was just curious to know if it was well-known that multiple commits may happen.
I'll do some more research into it and provide proper demo code if I can get repeatable results from a "toy" program (I don't think anyone would appreciate it if I posted the whole enchilada).
/k1 -
5. Re: Single call commits a dozen times.
aloubyansky Aug 16, 2004 4:51 AM (in response to komone)The COMMIT message in my case is from the wrapped java.sql.Connection.commit() method.