Thursday, April 8, 2010

Hibernate yes_no

This helped a bunch today!

Scenario:

  1. using JSF with some check boxes.
  2. Check boxes are stored in the bean as a Boolean
  3. Database field is a String (1 character) and stored as “Y” or “N”

Use Hibernate’s type="yes_no" for the property to convert the Boolean value to a String and back again.

No comments: