I have an @Entity
which has an @Enumerated
field mapped to it:
@Entity
@Table
public class Device implements Serializable {
@I
You have anotated it as
@Enumerated(EnumType.STRING)
this will store the name of the enum. Your db column will have either "MOBILE" or "EMAIL" but not 'true' or 'false'. you can change your query to
return factory.getCurrentSession().createCriteria(Device.class).
add(Restrictions.eq("typeOfDevice", DeviceType.MOBILE)).list();
Its more reable isn't?