I tried to look around for information regarding returning a list using Hibnerate but couldn’t find something that matches what I’m looking for and thus needs some advise.
I have the following classes
BPDataPK:
public class BPDataPK implements Serializable {
private String id;
private int userProfile;
private Date when;
.....
}
BPData:
public class BPData implements Serializable {
private BPDataPK dataPK;
private Date sessionStart;
...
}
HibernateBPDataDAO :
public class HibernateBPDataDAO extends HibernateDaoSupport implements IBPDataDAO{
....
public BPData[] getSessionBPData(Session session) throws Exception {
/**I need to get a list of BPData that matches the following
1. BPDataPK.id== session.getID;
2. BPDataPK.userProfile == session.getUserProfile;
**3. BPData.sessionStart == session.getSessionStart();**
*/
}
}
How do I return a list of BPData that matches two of the primary key and a non primary key??
You should not look around for some information. Instead, you should read the reference documentation.
This documentation has a full chapter dedicated to queries using the HQL query language, and another one dedicated to criteria queries. Since you have a fixed set of criteria here, HQL is more suited to the task: