-->
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.  [ 5 posts ] 
Author Message
 Post subject: Date Mapping Problem
PostPosted: Fri Nov 11, 2005 5:27 am 
Newbie

Joined: Mon May 16, 2005 9:59 pm
Posts: 2
one of the field in my value object is String , which i need to map with one of the field in DB table of datatype Date. This object is mapped through XXX.hbm.xml
Since this value object is used in some other existing running application, i dont want to change the datatype of it.
If i change the property type as String in XXX.hbm.xml file, it gives error.
Please let me know the way to do this.

Regards
Gopinath


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 11, 2005 7:14 am 
Beginner
Beginner

Joined: Fri Oct 28, 2005 10:46 am
Posts: 37
Make a constructor and/or getter/setter pair that does the conversions.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 13, 2005 10:32 pm 
Newbie

Joined: Mon May 16, 2005 9:59 pm
Posts: 2
will u plz explain in detail.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 13, 2005 10:41 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
post the full stack trace. have you tried a UserType?


Top
 Profile  
 
 Post subject: Re: Date Mapping Problem
PostPosted: Mon Nov 14, 2005 1:41 pm 
Newbie

Joined: Mon Nov 14, 2005 1:19 pm
Posts: 3
gopinathcool wrote:
one of the field in my value object is String , which i need to map with one of the field in DB table of datatype Date. This object is mapped through XXX.hbm.xml
Since this value object is used in some other existing running application, i dont want to change the datatype of it.
If i change the property type as String in XXX.hbm.xml file, it gives error.
Please let me know the way to do this.

Regards
Gopinath


This is a problem I've dealt with recently. What you can do is instead of loading your value objects directly from hibernate, load another object (a dto or some other model...it doesn't really matter what you call it because it's only a pojo anyway). This object can have whatever data types you need for hibernate. THEN write a bridge that takes your hibernate-loaded object and loads your VO doing any type conversions along the way. It adds a couple classes but it leaves your VO as you need it for the rest of your application.

Regards,
Kyle


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