Reputation: 493
I have one table which has composite primary key(2 columns) I need to retrieve data (or particular record) through hibernate (HQL).
Mapping of composite key in POJOs
is already done. but could not get any help on retrieving the data or an object from it.
Upvotes: 1
Views: 395
Reputation: 691675
MyEntityPK pk = new MyEntityPK(part1, part2);
MyEntity result = session.get(pk);
If you want help over a HQL query, show us the entity and its mapping, and tell us what the HQL query should do. But a HQL query is no different for an entity with a composite key than it is for an entity with a non-composite key.
Upvotes: 2