我有以下场景,我想从两个表中将不同的列提取到一个实体中:
实体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
,但我们只将userId
(createByUserId
)存储到TBL_DISCUSSION
表和用户的全名位于TBL_USER
表。
如何编写标准来实现这一目标?