Reputation: 5450
I am using Oracle as backend and when i try to insert any entry the sequence which hibernate is generating is of the order of "50010255" but in my db the current value of SEQ_AD_WORK sequence shows only "1000221" i am unable to figure out how that can happen.
following are my configurations
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.query.startup_check">false</prop>
<!--
<prop key="hibernate.hbm2ddl.auto">create</prop>
-->
</props>
</property>`
@Id
@Column(name = "ITEM_ID", unique = true, nullable = false, scale = 0)
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SEQ_AD_WORK")
@SequenceGenerator(name="SEQ_AD_WORK", sequenceName="SEQ_AD_WORK")
public Long getAdWorkItemId() {
return this.adWorkItemId;
}
Upvotes: 3
Views: 3116
Reputation: 5687
@Dhirendra: try this:-
@SequenceGenerator(name="SEQ_AD_WORK",sequenceName="SEQ_AD_WORK",,allocationSize=1)
SequenceHiLoGenerator is the default sequence generator for JPA and the default allocationSize value of 50,
Upvotes: 5