cancel
Showing results for 
Search instead for 
Did you mean: 

JPA Boolean Attribute

Former Member
0 Kudos

Hi all,

Does anybody knows if JPA SAP implementation has some feature do automatic mapping of Boolean attributes?

ie. my table has a char field that can be Y or N, so i need to map it on my entity like a Boolean attribute.

In Hibernate JPA have the @org.hibernate.annotation.Type(type=u201Cyes_nou201D)

Best regards

Accepted Solutions (1)

Accepted Solutions (1)

adrian_goerler
Active Participant
0 Kudos

Hi,

SAP JPA assumes that a boolean attribute is mapped to a numric column, ideally a SMALLINT column.

True is mapped to 1, false to 0.

If you are having existing data with a CHAR column containing Y and N as you describe it, I suggest that you map this column to a String field and convert to the boolean value in the get/set method.

-Adrian

Former Member
0 Kudos

Hi Adrian,

Thanks by response, really i will need to make mapping manually using @Basic.

Best regards

Answers (0)