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
Similar to the above (@Arthur Ronald F D Garcia), but you can also use JPA field access and leave the ivar in the type of the database with transient accessors - marking them @Transient. This ensures JPA acces the entity by field access but leaves the accessors available for appropriately typed usage.
Using the above example:
@Column(name="isconstrained")
private int isConstrained;
@Transient
public boolean getIsConstrained() {
return (isConstrained == 1);
}
@Transient
public void setIsConstrained(boolean isConstrained) {
this.isConstrained = (isConstrained? 1 : 0);
}