While iterating the data from one-to-may relationship in hibernate,the next record is not fe开发者_如何学Gotching, instead the first record printing twice if two records present in DB...
I just fetching the data from DB..
I haven't set data using Hibernate;
I'm going to take a stab at this. Depending on your query construction, it is possible that you can return rows more than once. This can be eliminated using result transformer.
Criteria criteria = ...
// Build your query
criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); // Ensure no duplicates
I have had to use this in several complex queries.
精彩评论