Hi Noel, I don't think this issue is fixed yet. I just reproduced it in H2 1.4.181. Here is the stacktrace:
org.h2.jdbc.JdbcSQLException: Commit or rollback is not allowed within a trigger; SQL statement: delete from PARTICIPANT where PARTICIPANT.LAST_SEEN_TIME < ? [90058-181] at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) at org.h2.message.DbException.get(DbException.java:179) at org.h2.message.DbException.get(DbException.java:155) at org.h2.message.DbException.get(DbException.java:144) at org.h2.engine.Session.checkCommitRollback(Session.java:541) at org.h2.engine.Session.rollback(Session.java:563) at org.h2.command.Command.executeUpdate(Command.java:276) at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:157) at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:143) at com.vtlr.backend.database.permission.CascadeToPermission.fire(CascadeToPermission.java:80) at org.h2.schema.TriggerObject.fireRow(TriggerObject.java:203) at org.h2.table.Table.fireRow(Table.java:934) at org.h2.table.Table.fireAfterRow(Table.java:924) at org.h2.command.dml.Delete.update(Delete.java:100) at org.h2.command.CommandContainer.update(CommandContainer.java:78) at org.h2.command.Command.executeUpdate(Command.java:254) at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:157) at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:143) at com.jolbox.bonecp.PreparedStatementHandle.executeUpdate(PreparedStatementHandle.java:205) at com.mysema.query.sql.dml.SQLDeleteClause.execute(SQLDeleteClause.java:159) ... 9 common frames omitted Gili On Friday, September 12, 2014 3:49:43 AM UTC-4, Noel Grandin wrote: > > This has been fixed in a newer version of H2. > > On 2014-09-12 04:39 AM, Gili wrote: > > Hi, > > > > I am getting "Commit or rollback is not allowed within a trigger" under > H2 1.3.176 but I am not actually rolling > > anything back. As far as I understand the following sequence of events > occurs: > > > > 1. Java code invokes: delete from PARTICIPANT where > PARTICIPANT.LAST_SEEN_TIME < ? > > 2. A "after delete" trigger runs, invoking: delete from PERMISSION where > ID = ? (at CascadeToPermission.java:80) > > 3. This triggers a rollback (looking at the H2 source code, caused by a > deadlock) > > 4. H2 throws the following exception: > > > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
