lakhaman
lakhaman

Reputation: 125

problem when retrieve data from hibernate many to many relationship

i have two table with many to many relationship when i apply findbyall method to this table it will retrieve one record multiple time (that is the record will be displayed for this perticular table as many time as there are different relation ship with other table) so how can i display each record once only. thank in advance.

Upvotes: 0

Views: 885

Answers (1)

Cuga
Cuga

Reputation: 17904

Add the 'distinct' transformer to your Criteria object, like so: crit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);

Upvotes: 1

Related Questions