Dec 15th, 2005, 04:10 AM
How to retrieve objects with composite keys using Hibernate?
Anybody knows how to do that? I cant seem to find a method in HibernateTemplate that does that. Do I have to use JdbcTemplate to access these kind of objects? Maybe an example would be an email with multiple attachments. Each email has an ID and an attachment has the email ID and the filename as its composite key, so the table schema for the attachment will have PRIMARY KEY ("EMAILID", "FILENAME") defined.
Dec 15th, 2005, 01:26 PM
Can you just do a query on those two columns? Only difference is this will return a list, and you'll have to get the first (and only) element in the list.