用户
问题
IssueAssigned
在我的primefaces数据表中,我使用以下查询
获取这些值SELECT I.issue_number, I.issue_describtion, U.first_name,US.first_name
FROM ISSUES I
LEFT JOIN ISSUE_ASSIGNED IA
ON I.issue_number = IA.Issue_number
LEFT JOIN USERS U
ON U.id = IA.assigned_to_user_id
LEFT JOIN USERS US
ON US.id = IA.assigned_by_user_id
同时也是用户的管理员会将问题分配给其他用户
在MSSQL中,上面的查询工作正常,为U.firstName和US.FirstName提供了正确的记录,因为它们是不同的用户。
MSSQL中的查询返回
PER-1675 Perform - Evaluation Form Export does not pull any data in Legacy Export Tool (Due 8/14) Ameh Sandip
PER-2048 Calculation of scores fails when the lower/upper bound value of a calculation text result is a Ameh Sandip
但是在Hibernate中,对于同一个查询,firstName和US.firstName都给出相同的结果
码
@Override
public List<Object> getIssueListForAssigingIssue (){
List<Object> allIssueList = getHibernateTemplate()
.getSessionFactory()
.getCurrentSession().createSQLQuery("SELECT I.issue_number, I.issue_describtion, IT.issue_type,U.first_name ,US.first_name "
+ "FROM ISSUES I "
+ "LEFT JOIN ISSUE_ASSIGNED IA "
+ "ON I.issue_number = IA.Issue_number "
+ "LEFT JOIN USERS U "
+ "ON U.id = IA.assigned_to_user_id "
+ "LEFT JOIN USERS US "
+ "ON US.id = IA.assigned_by_user_id ").list();
return allIssueList;
}
hibernate中的查询返回
PER-1675 Perform - Evaluation Form Export does not pull any data in Legacy Export Tool (Due 8/14) Ameh Ameh
PER-2048 Calculation of scores fails when the lower/upper bound value of a calculation text result is a Ameh Ameh
答案 0 :(得分:1)
我能够通过给两个列的别名给出解决方法hibernate在两列之间混淆