Details
-
Bug
-
Resolution: Fixed
-
High
-
1.6.6
-
None
-
3
-
Description
Steps to reproduce
1) In Administration > Permission Schemes, create a copy of the default permission scheme, called it "New"
2) In Administration > Projects, edit each project and move the permission scheme to "New" from default
3) Go to Administration > Permission Schemes and delete the default
4) Create a copy of the "New" can call it default
5) Shutdown and restart the server.
You will get the following:
ERROR - failed batch ERROR - Could not synchronize database state with session org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253) at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:92) at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:87) at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:222) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2229) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2665) at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:60) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106) at com.cenqua.crucible.hibernate.HibernateUtil.commitTransaction(HibernateUtil.java:132) at com.cenqua.crucible.model.managers.UserActionManager.checkAndCreateDefaultPS(UserActionManager.java:247) at com.cenqua.crucible.model.managers.UserActionManager.<init>(UserActionManager.java:99) at com.cenqua.crucible.model.managers.UserActionManager.getInstance(UserActionManager.java:80) at com.cenqua.crucible.fisheye.CrucibleBridgeImplementation.startup(CrucibleBridgeImplementation.java:41) at com.cenqua.fisheye.ctl.Run.mainImpl(Run.java:238) at com.cenqua.fisheye.ctl.Run.main(Run.java:39) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.cenqua.fisheye.FishEyeCtl.mainImpl(FishEyeCtl.java:105) at com.cenqua.fisheye.FishEyeCtl.main(FishEyeCtl.java:38) Caused by: java.sql.BatchUpdateException: failed batch at org.hsqldb.jdbc.jdbcStatement.executeBatch(Unknown Source) at org.hsqldb.jdbc.jdbcPreparedStatement.executeBatch(Unknown Source) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246) ... 27 more ERROR - Commit fail msg-0:Could not execute JDBC batch update ERROR - Commit fail msg-1:failed batch ERROR - Commit failed rolling back. org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253) at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:92) at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:87) at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:222) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2229) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2665) at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:60) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106) at com.cenqua.crucible.hibernate.HibernateUtil.commitTransaction(HibernateUtil.java:132) at com.cenqua.crucible.model.managers.UserActionManager.checkAndCreateDefaultPS(UserActionManager.java:247) at com.cenqua.crucible.model.managers.UserActionManager.<init>(UserActionManager.java:99) at com.cenqua.crucible.model.managers.UserActionManager.getInstance(UserActionManager.java:80) at com.cenqua.crucible.fisheye.CrucibleBridgeImplementation.startup(CrucibleBridgeImplementation.java:41) at com.cenqua.fisheye.ctl.Run.mainImpl(Run.java:238) at com.cenqua.fisheye.ctl.Run.main(Run.java:39) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.cenqua.fisheye.FishEyeCtl.mainImpl(FishEyeCtl.java:105) at com.cenqua.fisheye.FishEyeCtl.main(FishEyeCtl.java:38) Caused by: java.sql.BatchUpdateException: failed batch at org.hsqldb.jdbc.jdbcStatement.executeBatch(Unknown Source) at org.hsqldb.jdbc.jdbcPreparedStatement.executeBatch(Unknown Source) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246) ... 27 more
By turning off batch commits, you will discover the issue occur because crucible cannot find the permission scheme with id of 1, and will try to create a permission scheme of id 1 and name of default, which will clash with your exisitng default and cause a cannot insert duplicate error:
2009-02-11 11:41:50,906 ERROR [main] fisheye.app HibernateUtil-commitTransaction - Commit failed rolling back. org.hibernate.exception.ConstraintViolationException: could not insert: [com.cenqua.crucible.model.PermissionScheme] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2272) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2665) at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:60) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106) at com.cenqua.crucible.hibernate.HibernateUtil.commitTransaction(HibernateUtil.java:136) at com.cenqua.crucible.model.managers.UserActionManager.checkAndCreateDefaultPS(UserActionManager.java:251) at com.cenqua.crucible.model.managers.UserActionManager.<init>(UserActionManager.java:103) at com.cenqua.crucible.model.managers.UserActionManager.getInstance(UserActionManager.java:84) at com.cenqua.crucible.fisheye.CrucibleBridgeImplementation.startup(CrucibleBridgeImplementation.java:41) at com.cenqua.fisheye.ctl.Run.mainImpl(Run.java:203) at com.cenqua.fisheye.ctl.Run.main(Run.java:40) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.cenqua.fisheye.FishEyeCtl.mainImpl(FishEyeCtl.java:105) at com.cenqua.fisheye.FishEyeCtl.main(FishEyeCtl.java:38) Caused by: java.sql.SQLException: Violation of unique constraint SYS_CT_80: duplicate value(s) for column(s) NAME in statement [insert into PERM_SCHEME (name, PS_ID) values (?, ?)] at org.hsqldb.jdbc.Util.throwError(Unknown Source) at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105) at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:23) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2252) ... 23 more
Checking the FISHEYE_INST/var/data/crudb/crucible.script file you see
INSERT INTO PERM_SCHEME VALUES(2,'new') INSERT INTO PERM_SCHEME VALUES(3,'default')
i.e. no permission scheme of 1 and a permission schem that has name=default