The moose likes Other Open Source Projects and the fly likes Hibernate and boolean vs. integer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Hibernate and boolean vs. integer" Watch "Hibernate and boolean vs. integer" New topic

Hibernate and boolean vs. integer

Ted Bell
Ranch Hand

Joined: Jan 21, 2002
Posts: 52
Hi all,

I am attempting to use Hibernate for the first time, and had a question about persisting a boolean value to a column with a datatype of integer.

Basically the column in the database is a smallint (Informix) and I would like to expose this as a boolean to the client as a boolean on the javabean object.

Is there a way to translate these without adding additional properties on the bean (getting the client to use the boolean and Hibernate the short)?

Any help appreciated..
It is sorta covered in the JavaRanch Style Guide.
subject: Hibernate and boolean vs. integer
jQuery in Action, 3rd edition