Hibernate Criteria fetches duplicates - one to many association?

Up vote 0 down vote favorite share g+ share fb share tw.

Component --> --> feature 1 --> feature 2 --> feature 3 component has one to many relationship with feature Even though there are 3 different records in feature table, hibernate Criteria fetches only the last record and displays it for 3 times. I give my hbm file and also criteria code. Querying from component table is fine but the problem is with feature table only component.hbm.

Xml features.hbm. Xml Java class public class Test { public static void main(String args) { SessionFactory sessionFactory = new Configuration().configure(). BuildSessionFactory(); Session session = sessionFactory.openSession(); Criteria criteria = session.

CreateCriteria(feature. Class); List summaryList = criteria.list(); feature feature = new feature(); System.out. Println(summaryList.size()); // getting size correctly if(summaryList!

=null) { for(Object obj:summaryList) { feature = (feature)obj; // getting same values for each loop System.out. Println(feature.getScenarioDesc()); System.out. Println(feature.getScenarioId()); System.out.

Println(feature.getFeaturePK()); } } session.close(); } } hibernate hibernate-mapping link|improve this question edited 2 days ago asked Apr 4 at 18:30Aravindh an113.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions