Hibernate version: 3.2.0.cr2
Hibernate Annotations: 3.2.0.CR1
Hibernate Entity Manager: 3.2.0.CR1
EJB3 version: EJB-3.0 RC8-FD
JBoss version: 4.0.4.GA
Name and version of the database you are using: Ingres 3.0.105
Full stack trace of any exception that occurs:
Code:
13:22:20,140 WARN [JDBCExceptionReporter] SQL Error: 4615, SQLState: 5000B
13:22:20,140 ERROR [JDBCExceptionReporter] An error occurred while deleting a record.
13:22:20,140 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: could not delete: [ams.uptoip.server.user.management.model.hibernate.rights.Login#224]
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.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2384)
at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2516)
at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:73)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:144)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:993)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:340)
at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:475)
at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1491)
at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1110)
at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:324)
at org.jboss.tm.TxManager.commit(TxManager.java:240)
at org.jboss.aspects.tx.TxPolicy.endTransaction(TxPolicy.java:175)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:87)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:227)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
Caused by: ca.edbc.util.EdbcEx: An error occurred while deleting a record.
at ca.edbc.jdbc.EdbcObj.readResults(EdbcObj.java:785)
at ca.edbc.jdbc.EdbcObj.readResults(EdbcObj.java:576)
at ca.edbc.jdbc.EdbcPrep.exec(EdbcPrep.java:795)
at ca.edbc.jdbc.EdbcPrep.executeUpdate(EdbcPrep.java:466)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:251)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:23)
at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2363)
... 36 more
Hi!
When I'm executing the following code, I can not remove the inserted data anymore (I tried it with Hibernate and with the database itself).
Code:
protected @PersistenceContext(unitName = "XY_Manager", type = PersistenceContextType.TRANSACTION)
EntityManager em;
// Insert Domain
Domain domain = em.find(Domain.class, id);
if (domain == null) {
domain = new Domain();
domain.setName(name);
domain.setAddress(getAddress(domain.getAddress()));
em.persist(domain);
em.flush();
}
// Insert Login
Login login = new Login();
login.setName(name);
login.setPassword(password);
login.setDomain(domain);
login = em.merge(login);
em.flush();
// Remove works fine
//em.remove(loginHib); // OK
// Modify Login
login.setName("NEW NAME");
// Merge Login
login = em.merge(login);
em.flush();
// Remove does not work
em.remove(loginHib); // ERROR
What's wrong? The interesting thing is, that the remove works after the insert, but fails after the merge method.
This code does not work too (same error):
Code:
// Get Login
Login login = em.find(Login.class, 4);
// Modify Login
login.setName("NEW NAME");
// Merge Login
login = em.merge(login);
em.flush();
// Remove does not work
em.remove(loginHib); // ERROR
Has anyone an idea?
Thx, Christian