-->
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: @SequenceGenerator+Hibernate+Spring 3+load balacing servers
PostPosted: Wed May 29, 2013 9:47 am 
Newbie

Joined: Wed May 29, 2013 9:28 am
Posts: 1
Hi,

we have deployed Spring 3 + Hibernate application on 2 load balancing servers. the issue is with the Hibernate sequence generator.
after 50 insertions into the Database, hibernate is not calling the DB sequence nextval, it continuously incrementing the count. And due to this the sequence values from both the servers are overlapping and I am getting "Unique Constraint Violation" exception.

E.g. Say, first time the sequence values from both the servers are 100 and 150 respectively. When the sequence of first instance reaches 149, it is supposed to call seq.nextVal. But since it is not doing so and continuously incrementing the seq value to 150 which is used by other instance and it is failing.
default allocationSize: 50

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "CUSTOMER_ID_SEQ")
@SequenceGenerator(name = "CUSTOMER_ID_SEQ", sequenceName = "CUSTOMER_SEQ")
@Column(name = "CUST_ID", unique = true, nullable = false)
public long getCustId() {
return custId;
}

Could one help on this issue.
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.