Hi,
I am using the <hbm2ddl> exporter and the InformixDialect (Hibernate321)
I have an annotated class with the following primary key defined:-
Code:
@Table(name = "MYTABLE")
public class MyTable {
private Integer id;
@Id
@Column(name = "ID")
public Integer getId() {
return id;
}
}
I'm launching the ANT task as follows:-
Code:
<hbm2ddl delimiter=";" format="true" create="true" />
The generated DDL is as follows:
Code:
create table MYTABLE (
ID serial not null,
primary key (ID)
);
But, what I want is (primary key added after the create table - supported in the Dialect):
Code:
create table MYTABLE (
ID serial not null
);
alter table MYTABLE add constraint primary key (ID) constraint MYTABLE_PK;
Hibernate's PrimaryKey class defines two sqlConstraintString methods:
- one returns the string "primary key (columnname)" as used in the generated DDL above.
- the other returns the string from dialect.getAddPrimaryKeyConstraintString(constraintName).
Which in InformixDialect.java is: " add constraint primary key constraint " + constraintName + " ";
It's the latter method that I want to use - how do I annotate my class to acheive this?
Many thanks, Martin.