Announcement Announcement Module
Collapse
No announcement yet.
How to retrieve objects with composite keys using Hibernate? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

    Adrian

  • #2
    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.

    Comment

    Working...
    X