I need to have query like this:
select * from TABLE where Source_KEY in (1,2);
My Hibernate class is like this:
@Entity
@Table(name = "TABLE", schema = "SCH")
public class Table {
private Long key;
private Long id;
private Source src;
}
Source is another entity class,
@Entity
@Table(name = "SOURCE", schema = "SCH")
public class Source{
private Long Source_KEY;
}
Now i have written a criteria but it seems to have an issue. Please can anyone advice on this.
private static final List<String> STAY_SOURCE_KEY = asList(1,2);
criteria.add(Restrictions.in("Source_KEY", STAY_SOURCE_KEY));
This should be a list of Source class but how to to that in criteria. It has to form query like
select * from TABLE where Source_KEY in (1,2);