How to convert string to Boolean using ObjectTypeConverter
662894Oct 1 2008 — edited Oct 1 2008I am using 11g.
I am trying to convert a flag value which is stored in the database as Y or N.
I am trying to use the ObjectTypeConverter to do that however the code is throwing compilation error because both the Conversion value parameters are expected as String.
Please help. here is the code segment I am trying to use.
@ObjectTypeConverter (
name="booleanConverter",
dataType=java.lang.String.class,
objectType=java.lang.Boolean.class,
conversionValues={
@ConversionValue(dataValue="N", objectValue= new Boolean(false)),
@ConversionValue(dataValue="Y", objectValue=new Boolean(true))}
)
@Convert("booleanConverter")
public Boolean getDelivFlag()
{
return delivFlag;
}
Edited by: user5972543 on Oct 1, 2008 7:34 AM