-->
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 strategy for lots of List<String> properties
PostPosted: Sun Oct 23, 2011 6:24 pm 
Newbie

Joined: Tue Jul 14, 2009 11:00 am
Posts: 3
Hey,

I am dealing with quite a lot of classes that often use List<String> to capture generic lists of text information from users, e.g. a list of names or a list of risks or a list of thoughts. The values being captures don't need to be modeled in any more detail than a String, so I wouldn't want to have List<Name>, List<Risk> or List<Thought> for example.

The List<String> properties appear all over my class hierarchy and quite often a single model class will contain 2 or more of these kinds of properties, so for example

Code:
class Person {
   List<String> dreams;
   List<String> playedInstruments;
   List<String> favouriteFoods;
}


I wondered if there is an accepted mapping strategy for these kinds of things.

I can only imagine needing to create one to many join tables for each property which would work but seems verbose. I can't use one single table for strings because as shown sometimes a class ID will map to many strings for different properties.

I suppose I could also turn each property into a single String and CSV them and explode/implode but that seems also like it would need lots of code to do throughout all my classes.

If anyone has suggestions or knows that I should do it one way or the other then great. I guess I'd just like some validation of how I should tackle this, verbose or not.

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.