This is a known issue with Oracle.
http://issues.appfuse.org/browse/APF-718
Matt
On 5/22/07, chinofish <[EMAIL PROTECTED]> wrote:
I want to do some test staff in oracle,
so i use the command:
mvn package -Poracle
but i got a test error, the error log is as follows:
[shuibao_demo] ERROR [main] JDBCExceptionReporter.logExceptions(78) |
ORA-00001: 违反唯一约束条件 (SHUIBAO_DEMO.SYS_C0013393)
[shuibao_demo] ERROR [main]
AbstractFlushingEventListener.performExecutions(301) | Could not synchronize
database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC
batch update
at
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
at
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at
org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:249)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
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
org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:570)
at
org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:651)
at
org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:621)
at
org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:311)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:117)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy25.save(Unknown Source)
at
org.appfuse.tutorial.webapp.action.PersonActionTest.onSetUpBeforeTransaction(PersonActionTest.java:41)
at
org.springframework.test.AbstractTransactionalSpringContextTests.onSetUp(AbstractTransactionalSpringContextTests.java:168)
at
org.springframework.test.AbstractSingleSpringContextTests.setUp(AbstractSingleSpringContextTests.java:89)
at junit.framework.TestCase.runBare(TestCase.java:128)
It's clear that the error happened when execute
line
personManager.save(person)
of method
onSetUpBeforeTransaction
I found the real reason leading to the error was that:
the test case tried to insert a record with id=1 into the table Person
but there was already a record with id=1.
It seems that oracle can not process
" @Id @GeneratedValue(strategy = GenerationType.AUTO)"
correctly ??
oracle user sequence to deal with the situation, but unfortunately the start
value of the sequence is 1.
//it's a bit of ridiculous..
any suggestion will be great appreciated !!
chinofish
2007-05-23
--
http://raibledesigns.com