-
Type:
Bug
-
Status: Resolved (View Workflow)
-
Priority:
Major
-
Resolution:
Won't Fix
-
Affects Version/s: 4.2.0.GA_CP04, 4.3.0.GA_CP02, 4.2.0.GA_CP05, 4.3.0.GA_CP03, 4.2.0.GA_CP06, 4.3.0.GA_CP04, 4.2.0.GA_CP07, 4.3.0.GA_CP05, EAP 5.0.0.BETA, EAP 5.0.0.CR2, EAP 5.0.0.CR3, EAP 5.0.0.CR4 (FCS and BETA2), EAP 5.0.0.CR5, EAP 5.0.0
-
Fix Version/s: None
-
Component/s: Hibernate
-
Labels:None
-
Environment:
Entity Manager and PostgreSQL
-
Affects:Release Notes
-
Workaround:Workaround Exists
-
Workaround Description:
When using a char datatype, Hibernate is always specifying it as "not null". PostgreSQL doesn't requires char types to be non-null, so, it seems a bug in Hibernate.
Test: org.hibernate.ejb.test.callbacks.CallbackAndDirtyTest
Model: org.hibernate.ejb.test.callbacks.Person
SQL being generated: create table PERSON_TABLE (id int8 not null, address varchar(255), name varchar(255), country varchar(255), sex char(1) not null, zip varchar(255), primary key (id))
Because of this, the test testDirtyButNotDirty on the above class is getting the below exception. A temporary solution for this test is to add the "required" sex property.
javax.persistence.RollbackException: Error while commiting the transaction
at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:71)
at org.hibernate.ejb.test.callbacks.CallbackAndDirtyTest.testDirtyButNotDirty(CallbackAndDirtyTest.java:43)
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.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.hibernate.exception.DataException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:77)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:254)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:93)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:88)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2232)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2660)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:56)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
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.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54)
... 20 more
Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into PERSON_TABLE (address, name, country, sex, zip, id) values (San Francisco, Joe, USA,