-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: primary key name constraint using annotations / hbm2ddl
PostPosted: Tue Dec 04, 2007 12:41 pm 
Newbie

Joined: Sun Apr 01, 2007 2:08 pm
Posts: 4
We are using Hibernate annotations and hbm2ddl to generate our database schema. We need to control the constraint names of all foreign keys and primary keys (rather than the random names generated by the tool).

Foreign keys are no problem, as in the example below. However it is not clear how to provide a name for a primary key constraint name (not the column name). Note we want a genuine primary key, not just a unique index.

@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "GEOMETRY_ID")
@ForeignKey(name = "FK_ANATOMY_GEOMETRY")
public Geometry getGeometry() {
return geometry;
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.