Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

TopLink 11g JPA - @ObjectTypeConverter

JavatizerMar 3 2009 — edited Mar 4 2009
Dears,

I am using TopLink 11g JPA, my questions are:

- I have database column [GENDER VARCHAR2(1)] and attribute gender which contains either ("Male" or "Female"). I want to do conversion such as:
Object "Male" <==> Table "M"
Object "Female" <==> Table "F"
I have the following ObjectTypeConverter:

@ObjectTypeConverter (
name="genderConverter",
dataType=java.lang.String.class,
objectType=java.lang.String.class,
conversionValues={
@ConversionValue(dataValue="M", objectValue="Male"),
@ConversionValue(dataValue="F", objectValue="Female")}
)
public class EmployeeEntity implements Serializable {

@Convert("genderConverter")
@Column (name="GENDER")

private String gender;

==>
1) The code mentioned above compiles fine and the employee created without any error, but the conversion is not working.
2) I am not able to find any complete/detailed example on TopLink 11g/JPA. Most of the examples on the Web uses eclipselink and not TopLink 11g/JPA.
3) What is the difference between Customizer & Converter.

Looking for your support...

Thanks

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 1 2009
Added on Mar 3 2009
3 comments
996 views