Reputation: 31
Getting wrong values from sequence
In weblogic 11, I have 2 manages severs under 1 cluster. I have created 1 datasource on Admin server and attached to cluster. In hibernate side I am using
@XmlTransient
@Id
@Column(name = "id", nullable = false)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_NAME")
@SequenceGenerator(name = "SEQ_NAME", sequenceName = "SEQ_NAME")
public Integer getId() {
return this.id;
}
Exception:
org.hibernate.event.def.AbstractSaveEventListener saveWithGeneratedId - generated identifier: 41813, using strategy: org.hibernate.id.SequenceHiLoGenerator org.hibernate.util.JDBCExceptionReporter logExceptions - Could not execute JDBC batch update ......bla..bla..java.sql.BatchUpdateException: ORA-00001: unique constraint
Assumption is only on 2nd managed server I am facing this problem.
Can anyone suggest me please.
Upvotes: 3
Views: 843
Reputation: 2314
This might have nothing to do with the server configuration(Cluster etc).
You need to use the allocationSize option.
@SequenceGenerator(name = "productprice_productpriceid_seq", sequenceName = "productprice_productpriceid_seq", allocationSize=1)
Refer below for more details.
https://forum.hibernate.org/viewtopic.php?f=1&t=992448
Upvotes: 1