Here is my configuration:
- Hibernate 3.1 RC1
- Oracle 9 (org.hibernate.dialect.Oracle9Dialect)
- xdoclet hibernate module 1.2.3
I have xdoclet generating my mapping file, and SchemaExport is creating my SQL DDL from the mapping file. The problem is that I do not see a way to name the primary key constraint. I've searched the web, looked at the docs, searched the forum; no luck.
Is there a way to name the primary key constraint in the hibernate mapping file? And if so, is there a way to express it in xdoclet? (I'd be happy to know it can be done in the mapping file, and then chase down the xdoclet issue separately.)
Here's the xdoclet fragment:
/**
* @hibernate.id generator-class="mepp.MyGenerator"
* @hibernate.column name="subscription_id" length="28" sql-type="char(28)"
*/
String getId()
{
return id;
}
Which produces this mapping:
<id name="id" type="java.lang.String">
<column name="subscription_id" length="28" sql-type="char(28)" />
<generator class="mepp.MyGenerator"/>
</id>
and that, in turn, produces this SQL:
create table subscription (
subscription_id char(28) not null,
primary key (subscription_id)
);
What I really want it to produce is this SQL:
create table subscription (
subscription_id char(28) not null,
constraint pk_subscription_id primary key (subscription_id)
);
|