-->
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 java.util.Properties to VARCHAR
PostPosted: Wed Oct 15, 2008 3:59 pm 
Newbie

Joined: Fri Jun 30, 2006 6:55 pm
Posts: 2
Hi all,

I'm new to Hibernate so please bear with me.

I have a column in a table called XX_METADATA which would hold value like: host=101.11.12.1;port=90;user=nikhil;password=chang3m3!

How can I map this VARCHAR column so that I get a properties object in my Java object? i.e. getXXMetadata() would return java.util.Properties instead of first getting it as String and then running it through some utility class to convert semi-colon separated String into Properties Object)

Thanks
nikhil


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 15, 2008 5:17 pm 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
This sounds like the job for custom UserType. There is a short introduction in the docs: http://www.hibernate.org/hib_docs/v3/re ... pes-custom

You will still have to write the String <-> Properties conversion code, but at least it will be re-usable if you need it in more places.


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.