There is an annotation in Hibernate that can persist boolean types as \'Y\'/\'N\' in the database.
https://stackoverflow.com/questions/1154833/configure-hibernate-u
You can use like this
@Entity
public class Employee {
@Convert(converter=BooleanTFConverter.class)
private Boolean isActive;
}
@Converter
public class BooleanYNConverter implements AttributeConverter{
@Override
public String convertToDatabaseColumn(Boolean value) {
if (value) {
return "Y";
} else {
return "N";
}
}
@Override
public Boolean convertToEntityAttribute(String value) {
return "Y".equals(value);
}
}