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: How-to: Class attribute mapping from a different table
PostPosted: Sun May 08, 2005 12:43 pm 
Newbie

Joined: Sun May 08, 2005 12:28 pm
Posts: 1
Hibernate version: 3.0

Hello All,

I think this should be a very simple problem, but I seem to be having some difficulty finding the right solution. Let's say I have two database tables: TABLE and TABLE_TYPE (i.e a dining room table, etc.)

TABLE has a few attributes: ID, NAME, TABLE_TYPE_ID (FK), etc.

TABLE_TYPE has three attributes: TABLE_TYPE_ID (PK) , NAME (dining room table, kitchen table, end table, coffee table, etc.) , DESCRIPTION

Now, to simplify my class structure, I only want a 'Table' class where one of the attributes is 'tableTypeName', which I would read via the PK/FK relationship between TABLE and TABLE_TYPE (TABLE has only one TABLE_TYPE). This is where my problem lies. I can't quite figure out which mapping element to use in my .hbm file.

Can anyone please help me out here?? Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 08, 2005 1:28 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
crate many-to-one to table-type in mapping for TABLE

regards


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.