-->
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: org.hibernate.exception.ConstraintViolationException
PostPosted: Wed Feb 29, 2012 6:04 am 
Newbie

Joined: Wed Feb 29, 2012 5:52 am
Posts: 1
Exception: org.hibernate.exception.ConstraintViolationException: could not execute JDBC batch update

I have a composition of entities A composing B composing C . When I use camel-jpa/hibernate in a single thread they go in fine but when I use mutiple threads I get the exception in the subject.

I think the cause is hibernate is generating insert statements as opposed to update statements

and

putting them in the same JDBC update.

Question is how do I force camel-JPA/Hibernate to always lock the table do a clean select for the primary key before generating those statements so this way it would always force to do a select before generating an update ?


Top
 Profile  
 
 Post subject: Re: org.hibernate.exception.ConstraintViolationException
PostPosted: Thu Mar 01, 2012 3:21 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Hi,

Quote:
I think the cause is hibernate is generating insert statements as opposed to update statements

I really don't think that's the cause.

I suggest you as first step to disable jdbc-batching for the moment by specifying
Code:
hibernate.jdbc.batch_size = 0

this should give you more clear exception messages when jdbc-exceptions raise.

Then please report the exception again with complete message and full-stacktrace.
Usually (it depends on the undelying database and driver) there's also written which Constraint was violated.
Furthermore I suggest you to log all the jdbc-statements with p6spy.
Knowing the last jdbc-statement before the ConstraintViolationException raises and knowing which constraint is getting violated,
should help you to understand what's going wrong.


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.