-->
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: How to map an integer value to string value in code?
PostPosted: Thu Nov 20, 2008 6:48 pm 
Newbie

Joined: Mon May 29, 2006 5:46 pm
Posts: 2
Hi guys


I have legacy code that I am very reluctant to change due to having to recode/test everything. So I am trying to avoid changing old code if possible, however, I am integrating hibernate into this application.

With that said,

I have a bean (legacy code which I've mapped) with a property called myID (java.lang.String) which I want to map to a database column that is an integer type (Oracle Integer).

Is there any way to make hibernate automatically convert java string to a database integer without having to rewrite the bean class (but I am able to do anything with the mapping class)?

thanks in advanced


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 21, 2008 3:30 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
It should be possible by implementing a custom user type. See http://www.hibernate.org/hib_docs/v3/re ... pes-custom


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.