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: Hibernate mapping newbie question
PostPosted: Wed Mar 23, 2005 11:36 am 
Newbie

Joined: Wed Mar 23, 2005 11:05 am
Posts: 2
Hibernate version:2.1.8

Hi,

I have a newbie mapping question.

I have a simple class I want to map (
Code:
RewardImpl
). It has a number of easy properties (
Code:
Id, Amount
, etc.) but it also has a property called
Quote:
period
. This is of type
Code:
Duration
.

Code:
Duration
is an interface with many concrete subclasses like
Code:
MonthDuration
,
Code:
SimpleDuration
(2 arbitrarydates),
Code:
YearDuration
etc. The only data they hold is just 2 dates:
Code:
startDate
and
Code:
endDate
.

What I want to do is map this as a component since I do not want to have a different table for durations but I want Hibernate to instantiate the correct subclass. Can I do this within a component?

Am I missing something here?

Thanks in advance,
Harry


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 23, 2005 11:44 am 
Newbie

Joined: Wed Mar 23, 2005 11:05 am
Posts: 2
SORRY FOR THE FORMATTING ABOVE, PLEASE IGNORE IT. THE SAME MESSAGE FOLLOWS:

Hibernate version:2.1.8

Hi,

I have a newbie mapping question.

I have a simple class I want to map (RewardImpl). It has a number of easy properties (Id, Amount, etc.) but it also has a property called period
which is of type Duration.

Duration is an interface with many concrete subclasses like MonthDuration, SimpleDuration (2 arbitrarydates), YearDuration etc. The only data they hold is just 2 dates: startDate and endDate.

What I want to do is map this as a component since I do not want to have a different table for durations but I want Hibernate to instantiate the correct subclass. Can I do this within a component?

Am I missing something here?

Thanks in advance,
Harry


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.