-->
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: ID generation problem?
PostPosted: Fri Nov 02, 2012 7:43 pm 
Newbie

Joined: Fri Nov 02, 2012 7:17 pm
Posts: 1
I'm trying to debug a problem from customer log files. (I'm not able to reproduce the problem.) I can see several things wrong with our code, but would like to know whether, and how, those problems could cause these symptoms.

This is hibernate 3.3.2 with mysql 5.1, on Windows.

My table's mapping specifies generator increment. This is bad because we're running in a clustered environment. We have seen a few duplicate key errors which I understand could be caused by this.

The database table has its ID column defined as auto_increment. I understand this is nonsensical because hibernate is going to create the IDs, so the database auto_increment will not actually be used.

The error I don't understand is this:

org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; SQL [insert into MY_TABLE(col1, col2, col3, col4, ID_) values (?, ?, ?, ?, ?)]; constraint [null]

I've looked very closely at my code, and I don't see any way that any of the values coming from my application could be null, so I'm wondering if hibernate could possibly be passing in a null ID? Is there any scenario where this could happen?

Thanks for your help!


Top
 Profile  
 
 Post subject: Re: ID generation problem?
PostPosted: Mon Nov 05, 2012 4:51 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Quote:
The database table has its ID column defined as auto_increment.


If you use auto increment on database, then you have to use native generator instead of increment.


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.