-->
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 properties from a releated table
PostPosted: Wed Oct 15, 2008 11:48 am 
Newbie

Joined: Wed Aug 24, 2005 1:08 am
Posts: 8
I have a mapping question.

I have a person table that is shared by many applications. instead of continually adding new columns for application specific data we would like to have a separate table where these settings are added as rows with a column for the setting type.

Actually we have many tables that need this feature person/office/company/contact.

We would like to be able to do something like person.getSettings().getSetting1() which would return a string/integer/boolean depending on the type of setting. We want this property to be mutable so all we need to do is call person.getSettings().setSetting1(newvalue) to update the value. We also want to be able to use this property in a query "where person.settings.setting1 = 'test' ". We also want each property to be lazy loaded so its only queried when we need it.

Our original plan was to have one common settings table, and one common 'setting type' table. then create a many to many table for each entity. But we are ok with modifying this table structure if it means a easier mapping process.

I have seen the <component> tag with looks like it will get us the person.getSettings(), but I'm not sure where to go after that. I know I can do a <set><many-to-many> with a where clause, but that would return a list of Setting beans. I saw that if I change the table structure to use one settings table per entity, and eliminate the setting type table, I can use 23.4.1. "Typed" one-to-one association. but that would mean I need to person.getSettings().getSetting1().getValue(). and adding a new setting becomes more complicated because I need to create the Setting object (assumable with the correct type set by me),then set its value, and then call person.getSettings().setSetting1(newSettting)

I'm hopping there is a best practice for this type of situation, and that I just don't know the right search terms.

Thanks
Dave


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.