-->
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.  [ 2 posts ] 
Author Message
 Post subject: FK Constraint creation
PostPosted: Mon Nov 14, 2005 10:59 am 
Newbie

Joined: Thu Oct 28, 2004 1:58 am
Posts: 10
Location: Pune,India.
A. Not getting how to do this using annotations -

Eg.
class Param {
Constant cons;
}

class Constant { // no reference to Param
}

Requirement - Table generated should be,

1. Param_Table {param_id}

2. Constant_Table {const_id, param_id}

B. Sub classing and constraint creation -
Eg.
class Param {
}

class ConstantParam extends Param {
// Mapping to const_id in Constant_Table
Constant cons;
}

class OtherParam extends Param {
// NOT Mapping to other_id in Other_Table
Integer other;
}

class Constant {}

Param_Table {param_id, value_id} value_id points to const_id or other_id

Constant_Table {const_id}

Other_Table {other_id}

Currently, it create FK constraint on "value_id" of PARAM --> "const_id" of CONSTANT
I dont want any constraint to be created on "value_id" as it can store "other_id" also.


Thanks in advance,
Arpit


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 15, 2005 3:10 am 
Newbie

Joined: Thu Oct 28, 2004 1:58 am
Posts: 10
Location: Pune,India.
Is there any solution to avoid constraint creation in case of one-to-one mapping using Hibernate annotation ?

Any help will be highly appreciated !!

Thanks!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.