Hibernate prob - getting a row based on composite key?
I have got Hibernate working just fine when fetching rows based on one primary key, but now I have a situation where I need to fetch a row based on a composite key.
At present for a single key, I'm using: -
public Priority get(Integer id){
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
Priority thePriority = (Priority) session.get(Priority.class, id);
if (thePriority ==null){
thePriority =new Priority();
session.save(thePriority);
}
session.getTransaction().commit();
return thePriority;
}
...which seems to work fine after a little testing. Now though, I've got something like: -
public Priority get(Integer staffID, Integer projectID){
}
so I need to grab the row based on both these keys rather than just the one. How does that work then? :)

