Hello,
I'm quite new to hibernate.
I'm sorry if I'm posting something redundant or that I should have figured out myself from the doc, but I can't find any example similar to what I want to achieve. Which could mean I'm doing something wrong.
Basically, I have a class which is:
Code:
public class MainBundle {
int id;
String description;
Date releaseDate;
Price price;
}
And a subclass
Code:
public class ClientBundle extends Bundle {
Client client;
String description;
Price price;
}
The logic behind it is to override the default characteristics of a bundle for each client.
In terms of tables, I have a main_bundle table with four columns: bundle_id, description, release_date, price_id
And a client_bundle table with
bundle_id referencing main_bundle(bundle_id), description, price_id, client_id.
I'm trying to use annotations to do the mapping from the default class so that it overrides its attributes with client-specific settings when necessary. Would I have to have separate logic in my loadMainBundle() method to get all the client specific information, or is there a way for me to instantiate this data automatically indicating to hibernate to fetch it in the client_bundle table ?
I hope this is clear, any help will be appreciated, I'm not sure if my design is right, but if it is I have no idea how to map it using annotations (or XML mappings for that matter).
Thanks.