-->
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: Mapping multiple fields to one entity?
PostPosted: Mon Jan 28, 2008 1:34 pm 
Newbie

Joined: Fri Oct 05, 2007 4:28 pm
Posts: 3
Ok, this might be a noob question but I'm stumped. I have two tables one is a Comment table with an ID and the comments, the ID is an auto-increment column. The other table has the primary data and 6 columns that are a foriegn key to the Comment table. One column for the different comment types on the screen.

I am trying to figure out how to do this in a mapping file such that I can have the following class structure:

PrimaryClass
public int myId
public CommentClass GeneralCOmment { get ; set; }
public CommentClass SpecificComment { get; set; }

CommentClass
public int id
public string comment


The comment ID is specified in the table the Primary class is part of for each field. I was guessing I might be able to do a One-to-one mapping for each field but not sure. There is no comment types other than the column name being different. Assume we are unable to change the DB and that we would like to get all the data in one pass if possible.

Any help would be appreciated.

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.