-->
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: Parsing multiple keys from single column into a Set
PostPosted: Thu Jun 01, 2006 3:29 pm 
Newbie

Joined: Thu Jun 01, 2006 12:51 pm
Posts: 3
I've tried searching for this with no avail. I probably just don't have the right terminology. I'm not sure of the approach to take on this so I'd appreciate some help stepping in the right direction.

My task is this: In our database we have a table that is designed (which I can't change, and 'shouldn't' be changed for efficiencies sake) so that one column contains a string of keys to another table separated by '/'s

eg. {key1}/{key2}/{key3}

My ultimate goal is to be able to parse out those keys into a set of Objects for which they are keys/ids to. I need to do it in a way that hibernate does all of the work so that the objects can be lazy loaded and query-able. Obviously for persistance sake I need to be able to do the reverse: create a string of keys from a Set of objects.

So far I can only guess that I'll be implementing my own UserCollection and possibly my own Collection persister.

Any help on this would be greatly appreciated

-LiquidSix


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 02, 2006 12:33 pm 
Regular
Regular

Joined: Tue Nov 16, 2004 6:36 pm
Posts: 62
Location: Zürich
Other than toying with hibernate internals, why not use the simple approach of defining lifecycle methods on your class. Map the column to some internal String, then in the onLoad() method, expand the String into a Set, and before saving in onSave(), compact the Set into the String.


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.