-->
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.  [ 8 posts ] 
Author Message
 Post subject: Insert problem :(
PostPosted: Wed Mar 15, 2006 4:23 pm 
Senior
Senior

Joined: Wed Sep 24, 2003 3:01 pm
Posts: 158
Location: Bragan�a Paulista - Brasil
Hibernate version: 2.1.7
Oracle 9i

Hi,

I´m with problem when I try to insert a row into database.
The object to persist is complete with all properties,
but when generate insert Oracle, the oracle error occurs:

Code:
Caused by: java.sql.SQLException: ORA-01400: cannot insert NULL into ("PROJOWN1"."TAB_USER"."ID_PROFILE")

   at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
   at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
   at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
   at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
   at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
   at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:955)
   at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168)
   at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
   at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3368)
   at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:335)
   at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
   at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:468)
   ... 51 more


What happens here? :(

_________________
Tads


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 15, 2006 5:31 pm 
Beginner
Beginner

Joined: Thu Nov 11, 2004 12:18 pm
Posts: 37
Location: Baltimore, MD
Looks like you have a not-null constraint on your table that is being violated. Make sure all properties are mapped that are set up as not-null in the database.

Also, set the "hibernate.show_sql" hibernate property to "true", so you can verify the SQL generated is what you would expect.

_________________
-Chris


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 16, 2006 12:56 am 
Newbie

Joined: Mon Jun 06, 2005 10:11 am
Posts: 14
even though you have all properties populated, check if you have mapped it in hbm file or not.
/Ashwani

_________________
/Ashwani


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 16, 2006 7:27 am 
Senior
Senior

Joined: Wed Sep 24, 2003 3:01 pm
Posts: 158
Location: Bragan�a Paulista - Brasil
Sorry,

All properties are mapped in xml, e and properties have values
in the moment to use the session.save.
All columns in table area NOT NULL.

It´s very strange.
Below follow the insert generated. I forgot to put in the post.

Code:
17:22:44,750 INFO  [STDOUT] Hibernate: insert into tab_user (id_user, na_user, id_profile) values (?, ?, ?)
17:22:45,046 WARN  [JDBCExceptionReporter] SQL Error: 1400, SQLState: 23000


thanks

_________________
Tads


Top
 Profile  
 
 Post subject: cannot insert null problem
PostPosted: Thu Mar 16, 2006 8:49 am 
Newbie

Joined: Thu Mar 16, 2006 8:33 am
Posts: 2
Hibernate 2.1.8
MS SQL Server
I am getting the same problem while using generator class=identity

I read at one of the mailing lists that this is some bug in hibernate SQLDialect class. Can anybody confirm about this? and is this fixed in latest Hibernate or not??

Hibernate 3 has different directory structure too. Can anybody point to any reference for migrating from hibernate 2 to hibernate 3?

thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 16, 2006 8:57 am 
Senior
Senior

Joined: Wed Sep 24, 2003 3:01 pm
Posts: 158
Location: Bragan�a Paulista - Brasil
Can u provide the mailing lists where you found this?

thanks

_________________
Tads


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 16, 2006 9:37 am 
Senior
Senior

Joined: Wed Sep 24, 2003 3:01 pm
Posts: 158
Location: Bragan�a Paulista - Brasil
Now, I discovered that this problem only occurs when I REINSERT the object,
using session.delete and after session.save.

When I use different session and transaction, it works. :(

_________________
Tads


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 16, 2006 10:43 am 
Newbie

Joined: Thu Mar 16, 2006 8:33 am
Posts: 2
http://forum.hibernate.org/viewtopic.ph ... 1016814b30
over here see, "Posted: Tue Aug 03, 2004 1:43 pm Post subject:"
I have lost link to the other thread that tells it for SQL Server :|

I am using it for a fresh object to insert into database and getting error :|:|


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