Chetan created Bug HBX-1217
Issue Type: Bug Bug
Affects Versions: 3.6.0.CR1
Assignee: Unassigned
Attachments: SchemaExporter.7z
Components: ant
Created: 14/Feb/13 12:55 AM
Description:

While running the HibernateTool hbm2ddl task for generating DDL scripts from Entity. If I have an entity with a Sequence defined like follows:

@Entity
@SequenceGenerator(name="attachment_id_seq", sequenceName="attachment_id_seq", allocationSize=25)
public class UserEntity { @Id @GeneratedValue(generator="attachment_id_seq", strategy=GenerationType.SEQUENCE) private int id; private String userName; private String password; }

The Generated code I get is

drop table UserEntity cascade constraints;
drop sequence attachment_id_seq;
create table UserEntity (id number(10,0) not null, password varchar2(255 char), userName varchar2(255 char), primary key (id));
create sequence attachment_id_seq;

I wanted it to be something like

CREATE SEQUENCE attachment_id_seq INCREMENT BY 25;

Looks like the code in the SequenceGenerator.java at 146 (hibernate-core.jar) uses a deprecated method of Dialect.
String[] ddl = dialect.getCreateSequenceStrings(sequenceName) that returns
>>> return "create sequence " + sequenceName; //starts with 1, implicitly
We need it to return
>> return getCreateSequenceString( sequenceName ) + " start with " + initialValue + " increment by " + incrementSize;

Environment: Windows, JDK 1.6
Project: Hibernate Tools
Priority: Major Major
Reporter: Chetan
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira