• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use two table in criterion in hibernate

 
Bhupendra Dubey
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to use crterion with two table ??please help me

Criteria criteria=ss.createCriteria(AppDTO1.class, "m1");
criteria.createCriteria(AppDTO2.class, "m2");

criteria.setFetchMode("AppDTO2", FetchMode.JOIN);
criteria.add(Restrictions.eq("m1.category", "COMBINE"));

ProjectionList projectionList1=Projections.projectionList();
projectionList1.add(Projections.property("m1.category"));
projectionList1.add(Projections.property("m1.ag_contract"));
//m2.CATEGORY, m2.MODEL_SERIES, m2.MPI_MODEL, m2.MACHINE_NAME, m2.YEAR_OUT_PROD
projectionList1.add(Projections.property("m2.appDTO2ID.CATALOG_MODEL_ID"));
projectionList1.add(Projections.property("m2.appDTO2ID.PARTS_CATALOG_NUM"));
projectionList1.add(Projections.property("m2.appDTO2ID.MODEL_NAME_LABEL"));
projectionList1.add(Projections.property("m2.CATEGORY"));
projectionList1.add(Projections.property("m2.MODEL_SERIES"));
.
.

and i am getting error
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic