Hibernate has a built-in “yes_no” type that would do what you want. It maps to a CHAR(1) column in the database.
Basic mapping: <property name="some_flag" type="yes_no"/>
Annotation mapping (Hibernate extensions):
@Type(type="yes_no")
public boolean getFlag();
More Related Contents:
- Difference between FetchType LAZY and EAGER in Java Persistence API?
- How to map an entity field whose name is a reserved word in JPA
- Why is Hibernate Open Session in View considered a bad practice?
- How to convert a Hibernate proxy to a real entity object
- JPA CascadeType.ALL does not delete orphans
- Wrong ordering in generated table in jpa
- ImprovedNamingStrategy no longer working in Hibernate 5
- Correct use of flush() in JPA/Hibernate
- JPA & Criteria API – Select only specific columns
- How does the JPA @SequenceGenerator annotation work
- can someone please explain me @MapsId in hibernate?
- Make Hibernate ignore instance variables that are not mapped [duplicate]
- How do I properly cascade save a one-to-one, bidirectional relationship on primary key in Hibernate 3.6
- How to call Oracle Function or Procedure using Hibernate (EntityManager) or JPA
- Spring data JPA and hibernate detached entity passed to persist on ManyToMany relationship
- How to map the result set of a JPA NativeQuery to a POJO using SqlResultSetMapping
- Refresh and fetch an entity after save (JPA/Spring Data/Hibernate)
- Have JPA/Hibernate to replicate the “ON DELETE SET NULL” functionality
- Doing an “IN” query with Hibernate
- How can I avoid the Warning “firstResult/maxResults specified with collection fetch; applying in memory!” when using Hibernate?
- @Id @GeneratedValue but set own ID value
- Difference between save and saveAndFlush in Spring data jpa
- Inherited abstract class with JPA (+Hibernate)
- The onFlushDirty Hibernate Interceptor method is never called
- org.hibernate.MappingException: Could not determine type for: java.util.Set [duplicate]
- Difference between @MapKey, @MapKeyColumn and @MapKeyJoinColumn in JPA and Hibernate
- Why hibernate generates insert and update for OneToMany mapping
- What properties does @Column columnDefinition make redundant?
- org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags
- JPA Updating Bidirectional Association