-->
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: Generic table example
PostPosted: Thu Feb 24, 2005 11:01 am 
Beginner
Beginner

Joined: Thu Oct 14, 2004 5:07 am
Posts: 37
Location: Cambridge, UK
Hi,

I have a generic 'Cost' table. Two other tables (Car and Bike) share this Cost table.

So (for instance), instead of having:

table cost {
cost_id number,
bike_id number nullable,
car_id number nullable,
amount number
}

I have:

table cost {
cost_id number,
linking_id number,
linking_type varchar(2)
amount number
}

So in future, if a new entity wants to have a cost associated with it, I do not need to change the schema.

Is there an example that demonstrates how to setup the associations for this scenario?

Thanks for any help....

I can always manually saveOrUpdate(cost); and manually load the cost, but if I can get it working with cascades and proper associations it would be great...

Thanks


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.