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: Mapping Lookup Table Column as a Property
PostPosted: Fri Jan 30, 2009 11:15 am 
Newbie

Joined: Fri Jan 30, 2009 11:07 am
Posts: 1
Hi,

This is a really simple problem and I'm kicking myself for not being able to find a solution.

I would like to map a column from a lookup table as a property in a POCO. For example, I have an Address Class that has a fk (AddressTypeID) to an AddressType table.

I don't want to model AddressType as an class but rather just have the AddressType varchar field as a property of my Address class. I'm not sure how to do this - all the examples I've seen model the Lookup record as a seperate class.

I know one option is to use a formula but that supports select only not update/insert.

To Summarize:
1) I want 1 class such as Address that has a string property AddressType that describes the type (HOME, WORK, CONTACT, etc)
2) Physical Data Model has an Address entity with a fk to AddressType via an AddressTypeID. The Column in AddressType table that I want mapped to the property in my Address Class is AddressTypeName.
3) Solution that supports update/insert w/o creating a seperate class for the mapping table.

Thanks, Duane


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 02, 2009 3:58 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
You can use custom sql for select/insert/update:

http://nhforge.org/doc/nh/en/index.html#querysql-cud

Can't you change the data model ?

_________________
--Wolfgang


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.