-->
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: Overriding fields with subclass in other table
PostPosted: Fri Nov 02, 2007 12:43 pm 
Newbie

Joined: Fri Nov 02, 2007 12:25 pm
Posts: 1
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.


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.