Reputation: 1
I am using hibernate3-maven-plugin version 2.0 hbm2ddl to generate SQL scripts from code. I am using process-classes. I my Entity class I am using a sequence. @SequenceGenerator(name="sessionSeq", sequenceName="SESSION_SEQ", allocationSize=50, initialValue=1) When I run the Maven script, this generates create sequence hibernate_sequence; I wanted it to generate something like create sequence hibernate_sequence increment by 50;
Can someone help me?
I am using the following jars : hibernate-tools - 3.2.4.GA, hibernate-core - 3.6.1.Final, hibernate-entitymanager - 3.6.1.Final, hibernate-validator - 4.1.0.Final, hibernate-validator-legacy - 4.0.2.GA and DB related jars.
The hbm2ddl is not picking up the allocationSize=50 property of the @SequenceGenerator when I am trying to generate the .SQL file.
This is an extract of the code:
@Entity @SequenceGenerator(name="sessionInfoIdSeq", sequenceName="SESSIONINFO_ID_SEQ", allocationSize=50)
public class SessionInfo {
@Id @GeneratedValue(strategy = GenerationType.AUTO, generator="sessionInfoIdSeq")
private Integer id;
Upvotes: 0
Views: 532
Reputation: 1
Checked the API for hibernate-core-3.6.1 Final which is being used by the SchemaExport API. The SequenceGenerator.java class that was getting called from this jar was using a deprecated method from the Dialect class which was generating the Sequence Definition. The method was public String[] getCreateSequenceStrings(String sequenceName), instead if it would use the String getCreateSequenceString(String sequenceName, int initialValue, int incrementSize) from the Dialect class, it would have solved my problem.
Upvotes: 0