Rafael Roque Rafael Roque - 2 years ago 121
Java Question

Mapping Java boolean to Oracle number

I have a property created like this in my model:

public class Client {
private Boolean active;


My RDBMS is Oracle,and the column is a number(1,0)

How can I use the Restrictions API to achieve the following functionality?


Answer Source

Hibernate does the Boolean to Oracle NUMBER(1,0) automatically, so you can use a Boolean value in your Criteria queries and the generated SQL will use the database boolean format instead.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download