-->
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.  [ 3 posts ] 
Author Message
 Post subject: Mapping two columns in one UserType
PostPosted: Wed Oct 25, 2006 9:28 am 
Newbie

Joined: Wed Oct 25, 2006 8:47 am
Posts: 4
I have a CurrencyAmount object in my POJO that contains two properties (currency amount, currency type), each should be mapped to a different column in the database. If either of the two columns is null Ì'd like the whole object to be null, so I don't want to use a component, since it would instantiate the CurrencyAmount then call the setters with the null column(s).

Can I accomplish this with a UserType? Is there a way to map two columns with one UserType? Any other suggestions?

Thanks in advance
Paul


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 25, 2006 10:14 am 
Expert
Expert

Joined: Tue Dec 07, 2004 6:57 am
Posts: 285
Location: Nürnberg, Germany
You can achieve this with Hibernate's CompositeUserType

_________________
Please don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 27, 2006 3:32 am 
Newbie

Joined: Wed Oct 25, 2006 8:47 am
Posts: 4
So how does the mapping file look for this then, I'm using xdoclet to generate my mappings and Im not sure how to tell it that one property maps to two columns


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.