Hibernate Criteria连接两个表以从两个表中获取数据

时间:2013-08-06 17:10:42

标签: hibernate

我有以下场景,我想从两个表中将不同的列提取到一个实体中:

实体1:表格 - > TBL_DISCUSSION

public class Discussion{
private int discussionId;// primary key
private int discussionText;
private String createByUserId;// Foreign Key (TBL_USER.userId)
private String createByUserFullName;// This is just a property, and does not have   stored into table
private Timestamp createTimestamp;
}

实体2: 表 - > TBL_USER

public class User{
    private int userId;// primary key
    private int userFullName;
}

现在,我需要做的是我必须从TBL_DISCUSSION获取所有讨论,并为每个讨论创建者提取UserFullName,但我们只将userIdcreateByUserId)存储到TBL_DISCUSSION表和用户的全名位于TBL_USER表。

如何编写标准来实现这一目标?

0 个答案:

没有答案
相关问题