我认为hibernate不支持条件,
UNIOn ALL但是您可以使用两个条件查询来获得预期的结果:
Criteria cr1 = session.createCriteria(Suppliers.class); cr1.setProjection(Projections.projectionList() .add( Projections.property("supplier_id"), "supplier_id" ) );List results1 = cr1.list();Criteria cr2 = session.createCriteria(Orders.class); cr2.setProjection(Projections.projectionList() .add( Projections.property("supplier_id"), "supplier_id" ) );List results2 = cr2.list();results1.add(results2);List unionAllList = results1; //this is the expected result.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)