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
|