-->
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: Specify foreign key constraint for simple id column
PostPosted: Wed Jul 05, 2006 3:45 am 
Newbie

Joined: Wed Jul 05, 2006 3:09 am
Posts: 3
Hello all,

is it possible to specify a foreign key constraint for a column of type Long (using Annotations or in general, without using @Column.columnDefinition)?

The concrete Example:
I have the classes Company and Role.
Normally, the Role would have a ManyToOne association to a Company.
But, because of design decisions, we do not want to directly tie the Role to the Company.
Instead, the Role has a property companyId, that references the id of the Company.

Although, the Role.companyId shall lead to a foreign key constraint when the database schema is generated (using hbm2ddl).
We're using hibernate annotations, and there exists the feature @Column.columnDefinition.
By using this, we lose database independency, e.g. the columnDefinition must include the definition of the data type. So we do not really want to use this feature.

Do you know another possibility to specify the logical foreign key constraint?

Thanx in advance,
cheers,
Martin


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.