Tried this with hsqldb 1.8.0-RC10 and Hibernate 3.0.3, same problem. I got a tip on setting <property name="hibernate.jdbc.batch_size">0</property>, for getting a better error message. So here's the output of that:
Code:
2005-05-21 21:33:49,825 WARN net.sf.ehcache.config.Configurator - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/home/kristian/.m2/repository/ehcache/ehcache/0.7/ehcache-0.7.jar!/ehcache-failsafe.xml
Hibernate: /*insert packagename.DataElement*/insert into DataElement (name, description, active, type, id) values (?, ?, ?, ?, null)
Hibernate: call identity()
Hibernate: /*load packagename.DataElement*/select dataelemen0_.id as id0_, dataelemen0_.name as name2_0_, dataelemen0_.description as descript3_2_0_, dataelemen0_.active as active2_0_, dataelemen0_.type as type2_0_ from DataElement dataelemen0_ where dataelemen0_.id=?
Hibernate: /*insert packagename.DataElementValidation*/insert into DataElementValidation (dataElement, validator) values (?, ?)
Hibernate: /*insert collection row packagename.DataElementValidation.context*/insert into context (dataElement, validator, idx, elt) values (?, ?, ?, ?)
2005-05-21 21:33:51,388 WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: -10, SQLState: 23000
2005-05-21 21:33:51,391 ERROR org.hibernate.util.JDBCExceptionReporter - Try to insert null into a non-nullable column: column: FORMELEMENTTEMPLATE table: CONTEXT in statement [/*insert collection row packagename.DataElementValidation.context*/insert into context (dataElement, validator, idx, elt) values (?, ?, ?, ?)]
2005-05-21 21:33:51,413 ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: could not insert collection: [packagename.DataElementValidation.context#component[dataElement,validator]{validator=packagename.MinMaxValidator, dataElement=packagename.DataElement#1}]
at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.collection.AbstractCollectionPersister.recreate(AbstractCollectionPersister.java:908)
at org.hibernate.action.CollectionRecreateAction.execute(CollectionRecreateAction.java:23)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
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:726)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:320)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at packagename.HibernateTransactionManager.leave(HibernateTransactionManager.java:188)
at packagename.TransactionInterceptor.invoke(TransactionInterceptor.java:64)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174)
at $Proxy2.addDataElementValidation(Unknown Source)
at packagename.HibernateValidationStoreTest.testBasicDataElementValidation(HibernateValidationStoreTest.java:83)
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 junit.textui.TestRunner.doRun(TestRunner.java:116)
at com.intellij.rt.execution.junit2.IdeaJUnitAgent.doRun(IdeaJUnitAgent.java:57)
at junit.textui.TestRunner.start(TestRunner.java:172)
at com.intellij.rt.execution.junit.TextTestRunner2.startRunnerWithArgs(TextTestRunner2.java:23)
at com.intellij.rt.execution.junit2.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:97)
at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31)
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:78)
Caused by: java.sql.SQLException: Try to insert null into a non-nullable column: column: FORMELEMENTTEMPLATE table: CONTEXT in statement [/*insert collection row packagename.DataElementValidation.context*/insert into context (dataElement, validator, idx, elt) values (?, ?, ?, ?)]
at org.hsqldb.jdbc.Util.throwError(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at org.hibernate.persister.collection.AbstractCollectionPersister.recreate(AbstractCollectionPersister.java:889)
... 38 more
This is the mapping file:
Code:
<hibernate-mapping>
<class name="packagename.FormElementTemplateValidation">
<composite-id>
<key-many-to-one name="formElementTemplate" class="packagename.FormElementTemplate"/>
<key-property name="validator"/>
</composite-id>
<map name="context" cascade="all-delete-orphan">
<key>
<column name="formElementTemplate"/>
<column name="validator" length="150"/>
</key>
<map-key type="string" length="50"/>
<element type="string"/>
</map>
</class>
</hibernate-mapping>
Is it something wrong with how I do the mapping for the map? I've gone through the documentation for this and can't see what's wrong. It works with MySQL...
--
Cheers,
Kristian