-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: Strange unique constraint violation
PostPosted: Mon Dec 19, 2005 9:31 pm 
Newbie

Joined: Mon Dec 19, 2005 9:18 pm
Posts: 17
Location: Brussels, Belgium
Hi,

I'm currently working on a Spring+Hibernate+Oracle application and I've got a problem while running unit tests on my Spring service : I get a unique constraint violation on an emty database !

Here is the relevant JBoss log excerpt :
Quote:
WARN [JDBCExceptionReporter] SQL Error: 1, SQLState: 23000
ERROR [JDBCExceptionReporter] ORA-00001: unique constraint violation (OGS_TEST.SYS_C004434)

WARN [JDBCExceptionReporter] SQL Error: 1, SQLState: 23000
ERROR [JDBCExceptionReporter] ORA-00001: unique constraint violation (OGS_TEST.SYS_C004434)

ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update


The problem is that I don't see where this OGS_TEST.SYS_C004434 table comes from. It seems to be an index but still, I drop my database schema and I recreate it before each running of my tests.

And the most disturbing is that the very first time I ran those tests on my brand new OracleXE installation, it worked fine. And since then, nothing more. I've tried to drop the whole schema and recreate it (through Oracle administration console) but it didn't solve my issue.

Any idea ? Because I'm losing my words on that one.

_________________
Sébastien Arbogast


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 19, 2005 9:37 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
What's happening in your tests before the output you've provided? It says that there's a batch update, so the database can't be enitrely empty..

Is it possible that you're changing the value in a foreign key column somewhere in your tests? There's not much info in what you're provided, I couldn't guess more than that.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 19, 2005 10:28 pm 
Newbie

Joined: Mon Dec 19, 2005 9:18 pm
Posts: 17
Location: Brussels, Belgium
OK. I'll try to give you more then :
Quote:
INFO [XmlBeanDefinitionReader] Loading XML bean definitions from URL [file:C:/data/workspace/onegenesys/core/target/test-classes/testBeanRefFactory.xml]
INFO [ClassPathXmlApplicationContext] Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=7231150]: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [beanRefFactory]; root of BeanFactory hierarchy
INFO [ClassPathXmlApplicationContext] 1 beans defined in application context [org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=7231150]
INFO [CollectionFactory] JDK 1.4+ collections available
INFO [CollectionFactory] Commons Collections 3.x available
INFO [ClassPathXmlApplicationContext] Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@158497c]
INFO [ClassPathXmlApplicationContext] Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@11ce2ad]
INFO [DefaultListableBeanFactory] Pre-instantiating singletons in factory [org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [beanRefFactory]; root of BeanFactory hierarchy]
INFO [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [applicationContext.xml]
INFO [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [applicationContext-test-dataSource.xml]
INFO [ClassPathXmlApplicationContext] Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=17474178]: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [messageSource,sessionFactory,hibernateInterceptor,userDao,geneSysFieldDao,geneSysTableDao,productionDatabaseDao,referenceDatabaseDao,geneSysVersionDao,modifiedDataDifferenceDao,daAlertDao,addedRowDifferenceDao,daDifferenceDao,missingRowDifferenceDao,daReportDao,logItemDao,missingDataItemDao,addedDataItemDao,serviceTransactionInterceptor,differentialAnalyzer,dataSource,transactionManager]; root of BeanFactory hierarchy
INFO [ClassPathXmlApplicationContext] 22 beans defined in application context [org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=17474178]
INFO [ClassPathXmlApplicationContext] Using MessageSource [org.springframework.context.support.ResourceBundleMessageSource: basenames=[messages]]
INFO [ClassPathXmlApplicationContext] Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@37504d]
INFO [DefaultListableBeanFactory] Pre-instantiating singletons in factory [org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [messageSource,sessionFactory,hibernateInterceptor,userDao,geneSysFieldDao,geneSysTableDao,productionDatabaseDao,referenceDatabaseDao,geneSysVersionDao,modifiedDataDifferenceDao,daAlertDao,addedRowDifferenceDao,daDifferenceDao,missingRowDifferenceDao,daReportDao,logItemDao,missingDataItemDao,addedDataItemDao,serviceTransactionInterceptor,differentialAnalyzer,dataSource,transactionManager]; root of BeanFactory hierarchy]
INFO [DriverManagerDataSource] Loaded JDBC driver: oracle.jdbc.driver.OracleDriver
INFO [Environment] Hibernate 3.0.5
INFO [Environment] loaded properties from resource hibernate.properties: {hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=org.hibernate.dialect.Oracle9Dialect, hibernate.connection.datasource=java:/OneGeneSysDS}
INFO [Environment] using CGLIB reflection optimizer
INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
INFO [HbmBinder] Mapping class: com.merck.genesys.ogs.users.UserImpl -> OGS_USER
INFO [HbmBinder] Mapping collection: com.merck.genesys.ogs.users.UserImpl.watchedDatabase -> WATCHING
INFO [HbmBinder] Mapping class: com.merck.genesys.ogs.da.config.GeneSysFieldImpl -> GENE_SYS_FIELD
INFO [HbmBinder] Mapping class: com.merck.genesys.ogs.da.config.GeneSysTableImpl -> GENE_SYS_TABLE
INFO [HbmBinder] Mapping class: com.merck.genesys.ogs.da.config.ProductionDatabaseImpl -> PRODUCTION_DATABASE
INFO [HbmBinder] Mapping collection: com.merck.genesys.ogs.da.config.ProductionDatabaseImpl.watcher -> WATCHING
INFO [HbmBinder] Mapping class: com.merck.genesys.ogs.da.config.ReferenceDatabaseImpl -> REFERENCE_DATABASE
INFO [HbmBinder] Mapping class: com.merck.genesys.ogs.da.config.GeneSysVersionImpl -> GENE_SYS_VERSION
INFO [HbmBinder] Mapping class: com.merck.genesys.ogs.da.reporting.DaAlertImpl -> DA_ALERT
INFO [HbmBinder] Mapping class: com.merck.genesys.ogs.da.reporting.DaDifferenceImpl -> DA_DIFFERENCE
INFO [HbmBinder] Mapping joined-subclass: com.merck.genesys.ogs.da.reporting.AddedRowDifferenceImpl -> ADDED_DATA
INFO [HbmBinder] Mapping joined-subclass: com.merck.genesys.ogs.da.reporting.MissingRowDifferenceImpl -> MISSING_DATA
INFO [HbmBinder] Mapping joined-subclass: com.merck.genesys.ogs.da.reporting.ModifiedDataDifferenceImpl -> MODIFIED_DATA
INFO [HbmBinder] Mapping class: com.merck.genesys.ogs.da.reporting.DaReportImpl -> DA_REPORT
INFO [HbmBinder] Mapping class: com.merck.genesys.ogs.da.reporting.LogItemImpl -> LOG_ITEM
INFO [HbmBinder] Mapping class: com.merck.genesys.ogs.da.reporting.MissingDataItemImpl -> MISSING_DATA_ITEM
INFO [HbmBinder] Mapping class: com.merck.genesys.ogs.da.reporting.AddedDataItemImpl -> ADDED_DATA_ITEM
INFO [LocalSessionFactoryBean] Building new Hibernate SessionFactory
INFO [Configuration] processing extends queue
INFO [Configuration] processing collection mappings
INFO [HbmBinder] Mapping collection: com.merck.genesys.ogs.da.config.GeneSysTableImpl.fields -> GENE_SYS_FIELD
INFO [HbmBinder] Mapping collection: com.merck.genesys.ogs.da.config.ReferenceDatabaseImpl.compatibleGeneSysVersion -> GENE_SYS_VERSION
INFO [HbmBinder] Mapping collection: com.merck.genesys.ogs.da.config.ReferenceDatabaseImpl.tables -> GENE_SYS_TABLE
INFO [HbmBinder] Mapping collection: com.merck.genesys.ogs.da.config.GeneSysVersionImpl.deployedDatabase -> PRODUCTION_DATABASE
INFO [HbmBinder] Mapping collection: com.merck.genesys.ogs.da.reporting.DaAlertImpl.differences -> DA_DIFFERENCE
INFO [HbmBinder] Mapping collection: com.merck.genesys.ogs.da.reporting.AddedRowDifferenceImpl.addedData -> ADDED_DATA_ITEM
INFO [HbmBinder] Mapping collection: com.merck.genesys.ogs.da.reporting.MissingRowDifferenceImpl.missingData -> MISSING_DATA_ITEM
INFO [HbmBinder] Mapping collection: com.merck.genesys.ogs.da.reporting.DaReportImpl.alerts -> DA_ALERT
INFO [HbmBinder] Mapping collection: com.merck.genesys.ogs.da.reporting.DaReportImpl.reportLog -> LOG_ITEM
INFO [Configuration] processing association property references
INFO [Configuration] processing foreign key constraints
INFO [ConnectionProviderFactory] Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
INFO [SettingsFactory] RDBMS: Oracle, version: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Beta
INFO [SettingsFactory] JDBC driver: Oracle JDBC driver, version: 10.2.0.1.0
INFO [Dialect] Using dialect: org.hibernate.dialect.Oracle9Dialect
INFO [TransactionFactoryFactory] Using default transaction strategy (direct JDBC transactions)
INFO [TransactionManagerLookupFactory] No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
INFO [SettingsFactory] Automatic flush during beforeCompletion(): disabled
INFO [SettingsFactory] Automatic session close at end of transaction: disabled
INFO [SettingsFactory] JDBC batch size: 15
INFO [SettingsFactory] JDBC batch updates for versioned data: disabled
INFO [SettingsFactory] Scrollable result sets: enabled
INFO [SettingsFactory] JDBC3 getGeneratedKeys(): enabled
INFO [SettingsFactory] Connection release mode: null
INFO [SettingsFactory] Default batch fetch size: 1
INFO [SettingsFactory] Generate SQL with comments: disabled
INFO [SettingsFactory] Order SQL updates by primary key: disabled
INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
INFO [SettingsFactory] Query language substitutions: {}
INFO [SettingsFactory] Second-level cache: enabled
INFO [SettingsFactory] Query cache: disabled
INFO [SettingsFactory] Cache provider: org.hibernate.cache.EhCacheProvider
INFO [SettingsFactory] Optimize cache for minimal puts: disabled
INFO [SettingsFactory] Structured second-level cache entries: disabled
INFO [SettingsFactory] Echoing all SQL to stdout
INFO [SettingsFactory] Statistics: disabled
INFO [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
INFO [SettingsFactory] Default entity-mode: pojo
INFO [SessionFactoryImpl] building session factory
INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
INFO [SessionFactoryImpl] Checking 0 named queries
INFO [DefaultAopProxyFactory] CGLIB2 available: proxyTargetClass feature enabled
INFO [HibernateTransactionManager] Using DataSource [org.springframework.jdbc.datasource.DriverManagerDataSource@62ad0d] of Hibernate SessionFactory for HibernateTransactionManager
INFO [JdbcTransactionObjectSupport] JDBC 3.0 Savepoint class is available
INFO [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
INFO [SQLErrorCodesFactory] SQLErrorCodes loaded: [DB2, HSQL, MS-SQL, MySQL, Oracle, Informix, PostgreSQL, Sybase]
Hibernate: select hibernate_sequence.nextval from dual
Hibernate: select production0_.ID as ID, production0_.COUNTRY as COUNTRY4_, production0_.DESCRIPTION as DESCRIPT3_4_, production0_.HOST_NAME as HOST4_4_, production0_.PORT as PORT4_, production0_.SESSION_I_D as SESSION6_4_, production0_.USERNAME as USERNAME4_, production0_.PASSWORD as PASSWORD4_, production0_.STATUS as STATUS4_, production0_.SEQUENCE_NUMBER as SEQUENCE10_4_, production0_.DEPLOYED_VERSION_FK as DEPLOYED11_4_ from PRODUCTION_DATABASE production0_
Hibernate: select genesysver0_.ID as ID0_, genesysver0_.VERSION as VERSION6_0_, genesysver0_.SEQUENCE_NUMBER as SEQUENCE3_6_0_, genesysver0_.REFERENCE_DATABASE_FK as REFERENCE4_6_0_ from GENE_SYS_VERSION genesysver0_ where genesysver0_.ID=?
Hibernate: select referenced0_.ID as ID0_, referenced0_.VERSION as VERSION5_0_, referenced0_.HOST_NAME as HOST3_5_0_, referenced0_.PORT as PORT5_0_, referenced0_.SESSION_I_D as SESSION5_5_0_, referenced0_.USERNAME as USERNAME5_0_, referenced0_.PASSWORD as PASSWORD5_0_, referenced0_.STATUS as STATUS5_0_, referenced0_.DESCRIPTION as DESCRIPT9_5_0_, referenced0_.SEQUENCE_NUMBER as SEQUENCE10_5_0_ from REFERENCE_DATABASE referenced0_ where referenced0_.ID=?
Hibernate: select hibernate_sequence.nextval from dual
Hibernate: select tables0_.PARENT_REFERENCE_FK as PARENT9_1_, tables0_.ID as ID1_, tables0_.ID as ID0_, tables0_.TABLE_ID as TABLE2_3_0_, tables0_.NAME as NAME3_0_, tables0_.DESCRIPTION as DESCRIPT4_3_0_, tables0_.STATUS as STATUS3_0_, tables0_.SEQUENCE_NUMBER as SEQUENCE6_3_0_, tables0_.TO_BE_CHECKED as TO7_3_0_, tables0_.EXPORT_LOC_ID as EXPORT8_3_0_, tables0_.PARENT_REFERENCE_FK as PARENT9_3_0_ from GENE_SYS_TABLE tables0_ where tables0_.PARENT_REFERENCE_FK=? order by tables0_.PARENT_REFERENCE_FK
Hibernate: select fields0_.PARENT_TABLE_FK as PARENT13_1_, fields0_.ID as ID1_, fields0_.ID as ID0_, fields0_.FIELD_ID as FIELD2_2_0_, fields0_.NAME as NAME2_0_, fields0_.DESCRIPTION as DESCRIPT4_2_0_, fields0_.STATUS as STATUS2_0_, fields0_.SEQUENCE_NUMBER as SEQUENCE6_2_0_, fields0_.TO_BE_CHECKED as TO7_2_0_, fields0_.EXPORT_LOC_ID as EXPORT8_2_0_, fields0_.DATA_TYPE as DATA9_2_0_, fields0_.DATA_TYPE_PARAM1 as DATA10_2_0_, fields0_.DATA_TYPE_PARAM2 as DATA11_2_0_, fields0_.IDENTIFIER_IN_PARENT_TABLE as IDENTIFIER12_2_0_, fields0_.PARENT_TABLE_FK as PARENT13_2_0_ from GENE_SYS_FIELD fields0_ where fields0_.PARENT_TABLE_FK=? order by fields0_.PARENT_TABLE_FK
Hibernate: select fields0_.PARENT_TABLE_FK as PARENT13_1_, fields0_.ID as ID1_, fields0_.ID as ID0_, fields0_.FIELD_ID as FIELD2_2_0_, fields0_.NAME as NAME2_0_, fields0_.DESCRIPTION as DESCRIPT4_2_0_, fields0_.STATUS as STATUS2_0_, fields0_.SEQUENCE_NUMBER as SEQUENCE6_2_0_, fields0_.TO_BE_CHECKED as TO7_2_0_, fields0_.EXPORT_LOC_ID as EXPORT8_2_0_, fields0_.DATA_TYPE as DATA9_2_0_, fields0_.DATA_TYPE_PARAM1 as DATA10_2_0_, fields0_.DATA_TYPE_PARAM2 as DATA11_2_0_, fields0_.IDENTIFIER_IN_PARENT_TABLE as IDENTIFIER12_2_0_, fields0_.PARENT_TABLE_FK as PARENT13_2_0_ from GENE_SYS_FIELD fields0_ where fields0_.PARENT_TABLE_FK=? order by fields0_.PARENT_TABLE_FK
Hibernate: select genesysver0_.ID as ID0_, genesysver0_.VERSION as VERSION6_0_, genesysver0_.SEQUENCE_NUMBER as SEQUENCE3_6_0_, genesysver0_.REFERENCE_DATABASE_FK as REFERENCE4_6_0_ from GENE_SYS_VERSION genesysver0_ where genesysver0_.ID=?
Hibernate: select hibernate_sequence.nextval from dual
Hibernate: select genesysver0_.ID as ID0_, genesysver0_.VERSION as VERSION6_0_, genesysver0_.SEQUENCE_NUMBER as SEQUENCE3_6_0_, genesysver0_.REFERENCE_DATABASE_FK as REFERENCE4_6_0_ from GENE_SYS_VERSION genesysver0_ where genesysver0_.ID=?
Hibernate: select referenced0_.ID as ID0_, referenced0_.VERSION as VERSION5_0_, referenced0_.HOST_NAME as HOST3_5_0_, referenced0_.PORT as PORT5_0_, referenced0_.SESSION_I_D as SESSION5_5_0_, referenced0_.USERNAME as USERNAME5_0_, referenced0_.PASSWORD as PASSWORD5_0_, referenced0_.STATUS as STATUS5_0_, referenced0_.DESCRIPTION as DESCRIPT9_5_0_, referenced0_.SEQUENCE_NUMBER as SEQUENCE10_5_0_ from REFERENCE_DATABASE referenced0_ where referenced0_.ID=?
Hibernate: select hibernate_sequence.nextval from dual
Hibernate: select tables0_.PARENT_REFERENCE_FK as PARENT9_1_, tables0_.ID as ID1_, tables0_.ID as ID0_, tables0_.TABLE_ID as TABLE2_3_0_, tables0_.NAME as NAME3_0_, tables0_.DESCRIPTION as DESCRIPT4_3_0_, tables0_.STATUS as STATUS3_0_, tables0_.SEQUENCE_NUMBER as SEQUENCE6_3_0_, tables0_.TO_BE_CHECKED as TO7_3_0_, tables0_.EXPORT_LOC_ID as EXPORT8_3_0_, tables0_.PARENT_REFERENCE_FK as PARENT9_3_0_ from GENE_SYS_TABLE tables0_ where tables0_.PARENT_REFERENCE_FK=? order by tables0_.PARENT_REFERENCE_FK
Hibernate: insert into DA_REPORT (CREATION_DATE, ID) values (?, ?)
Hibernate: insert into DA_ALERT (REFERENCE_DATABASE_FK, CHECKED_DATABASE_FK, PARENT_REPORT_FK, ID) values (?, ?, ?, ?)
Hibernate: insert into DA_ALERT (REFERENCE_DATABASE_FK, CHECKED_DATABASE_FK, PARENT_REPORT_FK, ID) values (?, ?, ?, ?)
Hibernate: insert into DA_ALERT (REFERENCE_DATABASE_FK, CHECKED_DATABASE_FK, PARENT_REPORT_FK, ID) values (?, ?, ?, ?)
WARN [JDBCExceptionReporter] SQL Error: 1, SQLState: 23000
ERROR [JDBCExceptionReporter] ORA-00001: violation de contrainte unique (OGS_TEST.SYS_C004434)

WARN [JDBCExceptionReporter] SQL Error: 1, SQLState: 23000
ERROR [JDBCExceptionReporter] ORA-00001: violation de contrainte unique (OGS_TEST.SYS_C004434)

ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:74)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:181)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:226)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:490)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:495)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:468)
at org.springframework.transaction.interceptor.TransactionAspectSupport.doCommitTransactionAfterReturning(TransactionAspectSupport.java:258)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174)
at $Proxy16.analyzeAll(Unknown Source)
at com.merck.genesys.ogs.da.service.DifferentialAnalyzerImplTest.testAnalyzeAll(DifferentialAnalyzerImplTest.java:48)
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 junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:325)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(JUnitTask.java:848)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:556)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:532)
at org.apache.tools.ant.Task.perform(Task.java:341)
at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:185)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
at org.apache.commons.jelly.tags.core.IfTag.doTag(IfTag.java:88)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
at com.werken.werkz.Goal.fire(Goal.java:639)
at com.werken.werkz.Goal.attain(Goal.java:575)
at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
at org.apache.commons.jelly.tags.core.IfTag.doTag(IfTag.java:88)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
at com.werken.werkz.Goal.fire(Goal.java:639)
at com.werken.werkz.Goal.attain(Goal.java:575)
at com.werken.werkz.Goal.attainPrecursors(Goal.java:488)
at com.werken.werkz.Goal.attain(Goal.java:573)
at com.werken.werkz.Goal.attainPrecursors(Goal.java:488)
at com.werken.werkz.Goal.attain(Goal.java:573)
at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
at com.werken.werkz.Goal.fire(Goal.java:639)
at com.werken.werkz.Goal.attain(Goal.java:575)
at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:671)
at org.apache.maven.MavenSession.attainGoals(MavenSession.java:263)
at org.apache.maven.jelly.tags.maven.ReactorTag.doTag(ReactorTag.java:368)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
at com.werken.werkz.Goal.fire(Goal.java:639)
at com.werken.werkz.Goal.attain(Goal.java:575)
at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
at com.werken.werkz.Goal.fire(Goal.java:639)
at com.werken.werkz.Goal.attain(Goal.java:575)
at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193)
at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79)
at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110)
at com.werken.werkz.Goal.fire(Goal.java:639)
at com.werken.werkz.Goal.attain(Goal.java:575)
at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:671)
at org.apache.maven.MavenSession.attainGoals(MavenSession.java:263)
at org.apache.maven.cli.App.doMain(App.java:488)
at org.apache.maven.cli.App.main(App.java:1239)
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.werken.forehead.Forehead.run(Forehead.java:551)
at com.werken.forehead.Forehead.main(Forehead.java:581)
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.intellij.rt.execution.application.AppMain.main(AppMain.java:86)
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.intellij.rt.execution.application.AppMain.main(AppMain.java:86)
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.intellij.rt.execution.application.AppMain.main(AppMain.java:86)
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.intellij.rt.execution.application.AppMain.main(AppMain.java:86)
Caused by: java.sql.BatchUpdateException: ORA-00001: violation de contrainte unique (OGS_TEST.SYS_C004434)

at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10656)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:174)
... 123 more


As for knowing what's happening before that, it's hard to say since this seems to occur asynchronously.

Hope that helps.

_________________
Sébastien Arbogast


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 19, 2005 10:49 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
This should be all you need to track it down:

Code:
Hibernate: insert into DA_ALERT (REFERENCE_DATABASE_FK, CHECKED_DATABASE_FK, PARENT_REPORT_FK, ID) values (?, ?, ?, ?)
Hibernate: insert into DA_ALERT (REFERENCE_DATABASE_FK, CHECKED_DATABASE_FK, PARENT_REPORT_FK, ID) values (?, ?, ?, ?)
Hibernate: insert into DA_ALERT (REFERENCE_DATABASE_FK, CHECKED_DATABASE_FK, PARENT_REPORT_FK, ID) values (?, ?, ?, ?)
WARN [JDBCExceptionReporter] SQL Error: 1, SQLState: 23000
ERROR [JDBCExceptionReporter] ORA-00001: violation de contrainte unique (OGS_TEST.SYS_C004434)

WARN [JDBCExceptionReporter] SQL Error: 1, SQLState: 23000
ERROR [JDBCExceptionReporter] ORA-00001: violation de contrainte unique (OGS_TEST.SYS_C004434)

ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:74)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:181)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:226)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
...


Apparently one of those three inserts, all committed at the same time, is breaking referential integrity. You could either debug it, or else run the test several times, removing one of DA_ALERT's constraints at a time. When the test finally runs, you'll know which constraint you've broken.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 20, 2005 2:48 am 
Newbie

Joined: Mon Dec 19, 2005 9:18 pm
Posts: 17
Location: Brussels, Belgium
The problem is that each DaAlert entity is created in a loop by a DAO :
Code:
public Object create(final int transform, final com.merck.genesys.ogs.da.reporting.DaAlert daAlert)
    {
        if (daAlert == null)
        {
            throw new IllegalArgumentException(
                "DaAlert.create - 'daAlert' can not be null");
        }
        Object identifier = this.getHibernateTemplate().save(daAlert);
        daAlert.setId((java.lang.Long)identifier);
        return this.transformEntity(transform, daAlert);
    }

public com.merck.genesys.ogs.da.reporting.DaAlert create(
        com.merck.genesys.ogs.da.config.ProductionDatabase checkedDatabase,
        com.merck.genesys.ogs.da.config.ReferenceDatabase referenceDatabase)
    {
        return (com.merck.genesys.ogs.da.reporting.DaAlert)this.create(TRANSFORM_NONE, checkedDatabase, referenceDatabase);
    }

    public Object create(
        final int transform,
        com.merck.genesys.ogs.da.config.ProductionDatabase checkedDatabase,
        com.merck.genesys.ogs.da.config.ReferenceDatabase referenceDatabase)
    {
        com.merck.genesys.ogs.da.reporting.DaAlert entity = new com.merck.genesys.ogs.da.reporting.DaAlertImpl();
        entity.setCheckedDatabase(checkedDatabase);
        entity.setReferenceDatabase(referenceDatabase);
        return this.create(transform, entity);
    }


And the only unique constraint there is for DaAlert, if for the Id itself, which is correctly created by Hibernate template (which you can see in the log by the three "Hibernate: select hibernate_sequence.nextval from dual"). I've added System.out.println's in my code to debug, and all three DaAlert's have different id's. So I don't understand why I get this unique constraint violation in the end.

_________________
Sébastien Arbogast


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 20, 2005 2:49 am 
Newbie

Joined: Mon Dec 19, 2005 9:18 pm
Posts: 17
Location: Brussels, Belgium
The problem is that each DaAlert entity is created in a loop by a DAO :
Code:
public Object create(final int transform, final com.merck.genesys.ogs.da.reporting.DaAlert daAlert)
    {
        if (daAlert == null)
        {
            throw new IllegalArgumentException(
                "DaAlert.create - 'daAlert' can not be null");
        }
        Object identifier = this.getHibernateTemplate().save(daAlert);
        daAlert.setId((java.lang.Long)identifier);
        return this.transformEntity(transform, daAlert);
    }

public com.merck.genesys.ogs.da.reporting.DaAlert create(
        com.merck.genesys.ogs.da.config.ProductionDatabase checkedDatabase,
        com.merck.genesys.ogs.da.config.ReferenceDatabase referenceDatabase)
    {
        return (com.merck.genesys.ogs.da.reporting.DaAlert)this.create(TRANSFORM_NONE, checkedDatabase, referenceDatabase);
    }

    public Object create(
        final int transform,
        com.merck.genesys.ogs.da.config.ProductionDatabase checkedDatabase,
        com.merck.genesys.ogs.da.config.ReferenceDatabase referenceDatabase)
    {
        com.merck.genesys.ogs.da.reporting.DaAlert entity = new com.merck.genesys.ogs.da.reporting.DaAlertImpl();
        entity.setCheckedDatabase(checkedDatabase);
        entity.setReferenceDatabase(referenceDatabase);
        return this.create(transform, entity);
    }


And the only unique constraint there is for DaAlert, if for the Id itself, which is correctly created by Hibernate template (which you can see in the log by the three "Hibernate: select hibernate_sequence.nextval from dual"). I've added System.out.println's in my code to debug, and all three DaAlert's have different id's. So I don't understand why I get this unique constraint violation in the end.

_________________
Sébastien Arbogast


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 20, 2005 3:40 am 
Newbie

Joined: Mon Dec 19, 2005 9:18 pm
Posts: 17
Location: Brussels, Belgium
Actually, thanks to toad, I found out what this index corresponds to and I realized that there was a unique constraint on the other fields too. So I need to check what was generated by my MDA tool since obviously, this is the source of my problem.

Thanks for your help.

_________________
Sébastien Arbogast


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.