In my project i am using JPA 2.0 with eclipselink inplementation, an I have following problem:
I have defined entity with boolean column:
@Entity
public User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="USR_ID")
private Short id;
@Column(name="USR_NAME")
private String name;
@Column(name="USR_ACTIVE")
private boolean active;
.......
}
I want to create query which will return all active users, something like this:
select u from User u where u.active = TRUE;
But if I use that query I got exception that boolean can't be cast to Short (column in database is stored as smallint). Is there any correct way how to write this query?
Thanks