-->
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.  [ 1 post ] 
Author Message
 Post subject: Is there object-type-converter mapping type ?
PostPosted: Fri Apr 28, 2006 3:48 am 
Newbie

Joined: Thu Apr 27, 2006 3:46 am
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hi,

I heard Oracle toplink have object-type-converter mapping type.
And it automatically convert data between object-value and data-value.
As for mapping file please refer the file below.

If we call setSex("FEMALE") method in application,
The Toplink will execute SQL as below.

"insert into TEST values ( ... 'F' ...) "

And, getSex() will return "FEMALE" or "MALE" instead of "F" or "M".

Is there this kind of function in Hibernate3?
I can't find it from Hibernate3 document.

Any help will be appreciated.


There are a pritial mapping file and POJO file of Oracle Toplink.

(1) mapping xml file

<opm:attribute-mapping xsi:type="toplink:direct-mapping">
<opm:attribute-name>action</opm:attribute-name>
<opm:field table="TEST" name="SEX" xsi:type="opm:column"/>
<opm:converter xsi:type="toplink:object-type-converter">
<toplink:type-mappings>
<toplink:type-mapping>
<toplink:object-value xsi:type="xsd:string">MALE</toplink:object-value>
<toplink:data-value xsi:type="xsd:string">M</toplink:data-value>
</toplink:type-mapping>
<toplink:type-mapping>
<toplink:object-value xsi:type="xsd:string">FEMALE</toplink:object-value>
<toplink:data-value xsi:type="xsd:string">F</toplink:data-value>
</toplink:type-mapping>
</toplink:type-mappings>
</opm:converter>
</opm:attribute-mapping>


(2) POJO java file

public String getSex() {
return this.sex;
}


public void setSex(String sex) {
this.sex = sex;
}




Hibernate version:3.1.3


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.