-->
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: string bind parameters nullified on batch insert?
PostPosted: Tue Jan 23, 2007 8:05 pm 
Newbie

Joined: Tue Dec 20, 2005 1:32 pm
Posts: 2
Hi all,

I'm getting a really strange issue with Hibernate 3.2 and Oracle 10g Release 2 drivers. I'm not even sure yet if this is a hibernate issue, but here is what I'm seeing. Take a look at the output from the logs.

First the SQL and the pertinent bind parameter value:

2007-01-23 17:55:31,536[main] DEBUG org.hibernate.SQL - insert into IPCS_PLANNER (PlannerName, Password, WorkspaceID, PlannerFirstName, PlannerSurname, PlannerDescription, PrimaryLocID, PartnerID, CustomerID, MRUPage, ForceNewPWOnLogin, PWDate, AccountActive, UserCanChangePW, PWNeverExpires, HostPlannerID, PlannerID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into IPCS_PLANNER (PlannerName, Password, WorkspaceID, PlannerFirstName, PlannerSurname, PlannerDescription, PrimaryLocID, PartnerID, CustomerID, MRUPage, ForceNewPWOnLogin, PWDate, AccountActive, UserCanChangePW, PWNeverExpires, HostPlannerID, PlannerID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2007-01-23 17:55:31,537[main] DEBUG org.hibernate.type.StringType - binding 'testuser_rOZvJ' to parameter: 1

Notice how it says it's binding testuser_rOZvJ to parameter 1, which you can see from the SQL is PlannerName. Now for the error:

2007-01-23 17:55:31,573[main] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 1400, SQLState: 23000
2007-01-23 17:55:31,573[main] ERROR org.hibernate.util.JDBCExceptionReporter - ORA-01400: cannot insert NULL into ("AMCCARRI"."IPCS_PLANNER"."PLANNERNAME")

It's like the value that was bound to the parameter disappears.

The funny thing is, when I switch to an older Oracle 9 driver, this problem goes away. The driver I have the problem with is ojdbc14.jar, any version.

After tinkering with it, it seems to behave this way for all nchar or nvarchar fields. Numerics seem to get bound without any problems. Anybody have any idea what is going on? Also, to add further to the mystery, this only happens when I run under an eclipse junit test launcher. When run from the ant <junit/> task, it works fine. So I'm thinking it is something in my classpath or some config parameter that is set up in eclipse that isn't set up in ant. Anybody know what might cause this kind of behavior?

Here is the full stack trace:

org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:249)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
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.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:561)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:611)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:581)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:307)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:117)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
at $Proxy19.save(Unknown Source)
at com.Servigistics.utils.ObjectMother.createUser(ObjectMother.java:578)
at com.Servigistics.Gateway.AbstractGatewayTest.setUp(AbstractGatewayTest.java:42)
at com.Servigistics.Gateway.InstallSiteGatewayTest.setUp(InstallSiteGatewayTest.java:60)
at junit.framework.TestCase.runBare(TestCase.java:125)
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 org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
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: java.sql.BatchUpdateException: ORA-01400: cannot insert NULL into ("AMCCARRI"."IPCS_PLANNER"."PLANNERNAME")

at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10657)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
... 29 more


I would be curious if anybody has run into this problem before.


Top
 Profile  
 
 Post subject: running into same problem...
PostPosted: Thu Jun 19, 2008 11:40 am 
Newbie

Joined: Thu Jun 19, 2008 8:57 am
Posts: 2
Hi i am running into the same situation you listed here. did you find the problem? Please let me know.


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.