Max
Here is the log. The exception is thrown after the call to session.flush() (Hibernate3Session.flush() takes the session from the ThreadLocal and call flush if it's not null).
The message in portuguese (A atribuição de um valor NULL a uma coluna NOT NULL "TBSPACEID=7, TABLEID=40, COLNO=4" não é permitida) means: Setting a NULL value to a NOT NULL column "TBSPACEID=7, TABLEID=40, COLNO=4" isn't allowed.
Code:
22/12/2004 17:55:12 org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.0 beta 1
22/12/2004 17:55:12 org.hibernate.cfg.Environment <clinit>
INFO: loaded properties from resource hibernate.properties: {hibernate.cglib.use_reflection_optimizer=true, hibernate.jdbc.use_streams_for_binary=true}
22/12/2004 17:55:12 org.hibernate.cfg.Environment <clinit>
INFO: using java.io streams to persist binary types
22/12/2004 17:55:12 org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
22/12/2004 17:55:12 org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
22/12/2004 17:55:12 org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
22/12/2004 17:55:12 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
22/12/2004 17:55:13 org.hibernate.cfg.Configuration addResource
INFO: Mapping resource: br/ufsm/cpd/sg/Person.hbm.xml
22/12/2004 17:55:13 org.hibernate.cfg.HbmBinder bindRootClass
INFO: Mapping class: br.ufsm.cpd.sg.Person -> PESSOAS
22/12/2004 17:55:13 org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
22/12/2004 17:55:13 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing extends queue
22/12/2004 17:55:13 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing collection mappings
22/12/2004 17:55:13 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing association property references
22/12/2004 17:55:13 org.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
22/12/2004 17:55:13 org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.DB2Dialect
22/12/2004 17:55:13 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
22/12/2004 17:55:13 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
22/12/2004 17:55:13 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.classic.ClassicQueryTranslatorFactory
22/12/2004 17:55:13 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {TRUE=1, FALSE=0}
22/12/2004 17:55:13 org.hibernate.connection.ConnectionProviderFactory newConnectionProvider
INFO: Initializing connection provider: org.hibernate.connection.DriverManagerConnectionProvider
22/12/2004 17:55:13 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
22/12/2004 17:55:13 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
22/12/2004 17:55:13 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: false
22/12/2004 17:55:13 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.ibm.db2.jcc.DB2Driver at URL: jdbc:db2://localhost.br:50000/dbsmdev
22/12/2004 17:55:13 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=dbuser, password=****}
22/12/2004 17:55:14 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
22/12/2004 17:55:14 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): disabled
22/12/2004 17:55:14 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC result set fetch size: 10
22/12/2004 17:55:14 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Using default transaction strategy (direct JDBC transactions)
22/12/2004 17:55:14 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
22/12/2004 17:55:14 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
22/12/2004 17:55:14 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
22/12/2004 17:55:14 org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.EhCacheProvider
22/12/2004 17:55:14 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
22/12/2004 17:55:14 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
22/12/2004 17:55:14 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
22/12/2004 17:55:14 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Echoing all SQL to stdout
22/12/2004 17:55:14 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
22/12/2004 17:55:14 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
22/12/2004 17:55:14 org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
22/12/2004 17:55:14 net.sf.ehcache.config.Configurator configure
WARNING: No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/home/rgmoro/.maven/repository/ehcache/jars/ehcache-0.9.jar!/ehcache-failsafe.xml
22/12/2004 17:55:15 org.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
22/12/2004 17:55:15 org.hibernate.impl.SessionFactoryImpl checkNamedQueries
INFO: Checking 0 named queries
Hibernate: insert into PESSOAS (CONCORRENCIA, DT_ALTERACAO, HR_ALTERACAO, COD_OPERADOR, NOME_PESSOA, NATUREZA_JURIDICA, ID_PESSOA) values (?, ?, ?, ?, ?, 'F', ?)
22/12/2004 17:55:15 org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: -407, SQLState: 23502
22/12/2004 17:55:16 org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: A atribuição de um valor NULL a uma coluna NOT NULL "TBSPACEID=7, TABLEID=40, COLNO=4" não é permitida.
22/12/2004 17:55:16 org.hibernate.event.AbstractFlushingEventListener performExecutions
SEVERE: Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: could not insert: [br.ufsm.cpd.sg.Person]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:63)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.BasicEntityPersister.insert(BasicEntityPersister.java:1683)
at org.hibernate.persister.BasicEntityPersister.insert(BasicEntityPersister.java:2012)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:42)
at org.hibernate.impl.ActionQueue.executeActions(ActionQueue.java:232)
at org.hibernate.impl.ActionQueue.executeActions(ActionQueue.java:137)
at org.hibernate.event.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:255)
at org.hibernate.event.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:814)
at br.ufsm.cpd.commons.hibernate.Hibernate3Session.flush(Hibernate3Session.java:121)
at br.ufsm.cpd.sg.ListenerTest.tearDown(ListenerTest.java:18)
at junit.framework.TestCase.runBare(TestCase.java:130)
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: com.ibm.db2.jcc.b.SQLException: A atribuição de um valor NULL a uma coluna NOT NULL "TBSPACEID=7, TABLEID=40, COLNO=4" não é permitida.
at com.ibm.db2.jcc.b.ce.d(ce.java:975)
at com.ibm.db2.jcc.a.bd.k(bd.java:312)
at com.ibm.db2.jcc.a.bd.a(bd.java:61)
at com.ibm.db2.jcc.a.r.a(r.java:64)
at com.ibm.db2.jcc.a.bq.c(bq.java:217)
at com.ibm.db2.jcc.b.cf.C(cf.java:1109)
at com.ibm.db2.jcc.b.cf.a(cf.java:1505)
at com.ibm.db2.jcc.b.cf.executeUpdate(cf.java:322)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at org.hibernate.persister.BasicEntityPersister.insert(BasicEntityPersister.java:1667)
... 27 more
org.hibernate.exception.ConstraintViolationException: could not insert: [br.ufsm.cpd.sg.Person]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:63)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.BasicEntityPersister.insert(BasicEntityPersister.java:1683)
at org.hibernate.persister.BasicEntityPersister.insert(BasicEntityPersister.java:2012)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:42)
at org.hibernate.impl.ActionQueue.executeActions(ActionQueue.java:232)
at org.hibernate.impl.ActionQueue.executeActions(ActionQueue.java:137)
at org.hibernate.event.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:255)
at org.hibernate.event.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:814)
at br.ufsm.cpd.commons.hibernate.Hibernate3Session.flush(Hibernate3Session.java:121)
at br.ufsm.cpd.sg.ListenerTest.tearDown(ListenerTest.java:18)
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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
Caused by: com.ibm.db2.jcc.b.SQLException: A atribuição de um valor NULL a uma coluna NOT NULL "TBSPACEID=7, TABLEID=40, COLNO=4" não é permitida.
at com.ibm.db2.jcc.b.ce.d(ce.java:975)
at com.ibm.db2.jcc.a.bd.k(bd.java:312)
at com.ibm.db2.jcc.a.bd.a(bd.java:61)
at com.ibm.db2.jcc.a.r.a(r.java:64)
at com.ibm.db2.jcc.a.bq.c(bq.java:217)
at com.ibm.db2.jcc.b.cf.C(cf.java:1109)
at com.ibm.db2.jcc.b.cf.a(cf.java:1505)
at com.ibm.db2.jcc.b.cf.executeUpdate(cf.java:322)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at org.hibernate.persister.BasicEntityPersister.insert(BasicEntityPersister.java:1667)
... 27 more