-->
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.  [ 4 posts ] 
Author Message
 Post subject: Meaningful name to constraints
PostPosted: Sun Nov 30, 2003 3:11 am 
Newbie

Joined: Thu Aug 28, 2003 12:04 pm
Posts: 10
Location: Montreal / Canada
Here is an example of DDL script generated by hibernate for a constraint and associated foreign key index for a many to one relationship.

alter table BBS_TOPICS add constraint FK17DB1ED0875D93DC foreign key (BBS_FORUMS_ID) references BBS_FORUMS;
create index IX17DB1ED0875D93DC on BBS_TOPICS (BBS_FORUMS_ID);

Is there a way to specify the name of the constraint?
Looks like there is because the Mapping examples in the reference documentation have more meaningful names.

I am using Oracle9i.

Regards,
Fran


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 30, 2003 3:30 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Use the foreign-key attribute.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 30, 2003 3:42 am 
Newbie

Joined: Thu Aug 28, 2003 12:04 pm
Posts: 10
Location: Montreal / Canada
gavin wrote:
Use the foreign-key attribute.


This undocumented attribute works fine for the constraint.

What about the name of the index?

Many Thanks,
Fran


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 01, 2003 2:37 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I started to take a look at this and ended up remembering all the reasons why we removed auto-index creation from 2.0. So I got rid of that stuff again. Silly me.

Its of course always possible to add indexes by using the index attribute of the <key> mapping.


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

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.