-->
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: Hibernate mapping question with Oracle
PostPosted: Mon Sep 14, 2009 4:50 am 
Newbie

Joined: Mon Sep 14, 2009 4:38 am
Posts: 1
Hi,

I need to implement a synchronization mechanism between a Mainframe backend and Oracle so that data is available for both platforms. The "issue" is that primary keys (and foreign keys) are hexadecimal (always 16 positions) on the mainframe and those must be used in the same (format) on Oracle.

This seems to be possible in plain SQL on Oracle, thanks to the to_number and to_char function.

For example:

Code:
select to_number('FFFFFFFFFFFFFFFF','XXXXXXXXXXXXXXXX') from dual; // 1,84467440737096E19
select to_char(1,84467440737096E19,'XXXXXXXXXXXXXXXX') from dual; // FFFFFFFFFFFFFFFF


Now my question is, how do I achieve this in Hibernate? Is there a possibility to convert those values automatically with mappings? The Java POJO will retain those values as a String and I would like those automatically converted from Java String to Oracle Number (in the above mentioned format) and vice versa when doing selects and inserts/updates in Oracle.

Thanks for the help.


Top
 Profile  
 
 Post subject: Re: Hibernate mapping question with Oracle
PostPosted: Thu Nov 26, 2009 10:11 am 
Newbie

Joined: Thu Nov 26, 2009 10:08 am
Posts: 4
I have a similar issue. I want to be able to convert hexadecimal strings into integer. The cast( [column] as integer) doesn't seem to handle strings in formats other than decimal.


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.