-->
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.  [ 1 post ] 
Author Message
 Post subject: PostInsertEventListener and Transaction - double insert
PostPosted: Thu Feb 16, 2006 10:51 am 
Newbie

Joined: Sun Oct 24, 2004 8:53 pm
Posts: 6
Location: Philadelphia, PA
I am using hibernate v 3.1.beta1 and Spring 1.2.6

While using hibernate's PostInsertEventListener I am having a double insert issue.

I have a saveAbc(Abc abc) method defined in a singleton service object and that has spring-transaction annotation
@Transactional(propagation = Propagation.REQUIRED)

There is a PostInsertEventListener setup that has following in its onPostInsert() method implementation. It calls another singleton service object's saveHistory(Object o) that has spring-transaction annotation
@Transactional(propagation = Propagation.REQUIRED)

What happens is - I see the INSERT statement twice logged by hibernate and due to unique id contsraint on db side, this fails. The INSERT seems to happen in batch and during an internal flush call it tries to commit all to database, when I see error.

Has anyone seen something like this? any clues??

Thanks in advance


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.