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: Problem with Hibernate generated insert statement
PostPosted: Thu Apr 29, 2010 7:13 pm 
Newbie

Joined: Fri Jun 13, 2008 11:36 am
Posts: 13
Hi, my basic problem is that I am trying to use hibernate to insert a record but I keep getting an exception because it is trying to insert '' into date fields that aren't filled and this is the wrong syntax.

More info:

I am using Postgres 8.4.
I am reading the SQL using p6spy
My exception message is "Exception: org.hibernate.exception.DataException: could not insert: [com.company.Mytable]"

Any assistance is appreciated. I thank you in advance!


Top
 Profile  
 
 Post subject: Re: Problem with Hibernate generated insert statement
PostPosted: Thu Apr 29, 2010 8:17 pm 
Newbie

Joined: Fri Jun 13, 2008 11:36 am
Posts: 13
I found the answer!

In the class tag of the hbm.xml file, add dynamic-insert="true"

This property makes it only insert non-null columns.


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.