SELECT (Title + ' ' & Forename & ' ' & Surname) AS FullName FROM details;
或
SELECT (Title || ' ' || Forename || ' ' || Surname) AS FullName FROM details;
我也想用 FullName的休眠投影
答案 0 :(得分:0)
如果您想要条件库投影,可以使用ProjectionList
ProjectionList prjection = Projections.projectionList();
if(abc){
prjection.add(Projections.property("firstname"));
}
else if(xyz){
prjection.add(Projections.property("Surname"));
}
........
criteria.setProjection(prjection);
如果你想在标准中使用OR / And Condition而不是你可以使用 Junction invitationTypeNotJunction = Restrictions.conjunction(); Junction invitationTypeJunction = Restrictions.disjunction();
您可以参考http://www.java2s.com/Tutorial/Java/0350__Hibernate/RestrictionsDisjunction.htm链接获取更多信息