数据库表详情:
EmployeeDetail:
employeeId
和team
组成,其他列为lname
,fname
EmployeePerformance:
employeeId
和employeeId
,month
组成,其他列为grade
我应该如何编写上表详细信息的实体类(持久性)?
我有两个具有嵌入式ID
的持久化类@Entity
public class EmployeePerformance {
@EmbeddedId
private EmployeePerformancePK emplPerfPK;
private String grade;
}
@Embeddable
public class EmployeePerformancePK {
private int employeeId;
private String month;
}
@Entity
public class EmployeeDetail {
@EmbeddedId
private EmployeeDetailPK emplPerfPK;
private String lname;
private String fname;
}
@Embeddable
public class EmployeeDetailPK {
private int employeeId;
private String team;
}
使用JPA概念
我想在spring web service
中执行此查询SELECT
FROM EmployeeDetail
INNER JOIN EmployeePerformance ON EmployeeDetail.employeeId = EmployeePerformance.employeeId
WHERE EmployeePerformance.grade = "B";