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? :)

[1267 byte] By [RageMatrix36a] at [2007-11-27 7:58:49]
# 1
Never mind - fixed it.
RageMatrix36a at 2007-7-12 19:40:46 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...