-->
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.  [ 2 posts ] 
Author Message
 Post subject: Upgrade from 3.5.6 to 3.6.0.Final results in NOT NULL issues
PostPosted: Sun Oct 24, 2010 1:04 pm 
Senior
Senior

Joined: Sun Oct 26, 2003 5:05 am
Posts: 139
Like most applications, I load test data before the test starts and delete it afterwards. This has always worked from 3.3.2.GA to 3.5.6.Final. For some reason, upgrading from 3.5.6.Final to 3.6.0.Final causes these exceptions to occur:

I'm using hsqldb 2.0.0

Code:
org.springframework.dao.DataIntegrityViolationException: StatementCallback; SQL [INSERT INTO task(task_id, name, module_id, ordering, delay) VALUES('1', 'Star Trek', '1', '0', '0');]; integrity constraint violation: NOT NULL check constraint; SYS_CT_10143 table: TASK; nested exception is java.sql.SQLException: integrity constraint violation: NOT NULL check constraint; SYS_CT_10143 table: TASK
   at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:101)
   at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
   at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
   at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
   at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:406)
   at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:518)
   at scaladbtest.model.Record.insert(Record.scala:57)
   at scaladbtest.model.TestData$$anonfun$insertAll$1$$anonfun$apply$1.apply(TestData.scala:41)
   at scaladbtest.model.TestData$$anonfun$insertAll$1$$anonfun$apply$1.apply(TestData.scala:40)
   at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
   at scala.collection.immutable.List.foreach(List.scala:45)
   at scaladbtest.model.TestData$$anonfun$insertAll$1.apply(TestData.scala:40)
   at scaladbtest.model.TestData$$anonfun$insertAll$1.apply(TestData.scala:40)
   at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:57)
   at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:43)
   at scaladbtest.model.TestData.insertAll(TestData.scala:40)
   at scaladbtest.test.ScalaDbTester.onBefore(ScalaDbTester.scala:44)
   at scaladbtest.test.ScalaDbTester.onBefore(ScalaDbTester.scala:35)
   at jobprep.DatabaseTests.insertDbUnitData(DatabaseTests.java:54)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
   at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
   at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
   at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
   at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
   at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
   at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
   at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
   at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
   at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
   at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
   at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
   at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
   at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
   at org.junit.runners.Suite.runChild(Suite.java:128)
   at org.junit.runners.Suite.runChild(Suite.java:24)
   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
   at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
   at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
   at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:94)
   at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:192)
   at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:64)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
Caused by: java.sql.SQLException: integrity constraint violation: NOT NULL check constraint; SYS_CT_10143 table: TASK
   at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
   at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source)
   at org.hsqldb.jdbc.JDBCStatement.executeUpdate(Unknown Source)
   at com.mchange.v2.c3p0.impl.NewProxyStatement.executeUpdate(NewProxyStatement.java:64)
   at org.springframework.jdbc.core.JdbcTemplate$1UpdateStatementCallback.doInStatement(JdbcTemplate.java:508)
   at org.springframework.jdbc.core.JdbcTemplate$1UpdateStatementCallback.doInStatement(JdbcTemplate.java:1)
   at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:395)
   ... 54 more
Caused by: org.hsqldb.HsqlException: integrity constraint violation: NOT NULL check constraint; SYS_CT_10143 table: TASK
   at org.hsqldb.error.Error.error(Unknown Source)
   at org.hsqldb.Table.enforceRowConstraints(Unknown Source)
   at org.hsqldb.Table.insertSingleRow(Unknown Source)
   at org.hsqldb.StatementDML.insertSingleRow(Unknown Source)
   at org.hsqldb.StatementInsert.getResult(Unknown Source)
   at org.hsqldb.StatementDMQL.execute(Unknown Source)
   at org.hsqldb.Session.executeCompiledStatement(Unknown Source)
   at org.hsqldb.Session.executeDirectStatement(Unknown Source)
   at org.hsqldb.Session.execute(Unknown Source)
   ... 60 more


It's a rather curious problem because the actual values are not NULL at all. It's sending the correct values! What could cause this? Anything besides the Schema reference change in the mappings?


Top
 Profile  
 
 Post subject: Re: Upgrade from 3.5.6 to 3.6.0.Final results in NOT NULL issues
PostPosted: Sun Oct 24, 2010 1:11 pm 
Senior
Senior

Joined: Sun Oct 26, 2003 5:05 am
Posts: 139
Actually, I think I might understand. I ran the same test suite with mysql and I get the following exception, which is more helpful:

Code:
org.springframework.jdbc.UncategorizedSQLException: StatementCallback; uncategorized SQLException for SQL [INSERT INTO task(task_id, name, module_id, ordering, delay) VALUES('1', 'Star Trek', '1', '0', '0');]; SQL state [HY000]; error code [1364]; Field 'description' doesn't have a default value; nested exception is java.sql.SQLException: Field 'description' doesn't have a default value
   at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
   at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
   at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)


This basically means that older versions of hibernate used to put in default values when it generated the DDL/schema... but now it no longer does. You guys should add this to the migration guide for sure. This is pretty huge.

Is there any way to quickly get back to the old behaviour without having to add in all the default values? This is just test data, so honestly, I don't really care about it as the description field is pretty much irrelevant. There is over 20,000 characters of test data in the file and I'd rather not have to go through them 1-by-1 to fix them.

EDIT: I guess it wasn't so bad... that was the only one that needed fixing ;) I just set description="". I'm assuming this had to be a bug fix then... and I was just getting a bad insert to pass all along.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.