-->
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: One to many with composite key?
PostPosted: Thu Oct 06, 2005 5:26 am 
Contributor
Contributor

Joined: Sat Sep 24, 2005 11:25 am
Posts: 198
Again, a bad title.
I've the following problem:

CREATE TABLE Rules ( id int, ... )

CREATE TABLE RulesObjects ( id int, ruleid int, object_type int, object_id);

Rules can be spesified on several types of objects. What I want to happen is that when I load the object, it would also load the collection of rules.
The problem is that the object_id may not be unique across objects.
I don't know what I should use here, a where clause that specify which object type to limit this to or try to use a composite key somehow.

Any suggestion about the recommended approach?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 5:29 am 
Contributor
Contributor

Joined: Sat Sep 24, 2005 11:25 am
Posts: 198
One more thing, is there a way to specify that deleting a rule will delete all the references to this rule?


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.