【发布时间】:2018-10-06 12:57:47
【问题描述】:
我有一个带有 EmbeddedId 的类 Application,并且 embbbedID 中的第二列是 forgein 键,并且与 offer 有多对一的关系。
@Entity
public class Application implements Serializable{
private Integer id;
@EmbeddedId
private MyKey mykey;
private String resume;
@Enumerated(EnumType.STRING)
@NotNull
private ApplicationStatus applicationStatus;
@Embeddable
public class MyKey implements Serializable{
private static final long serialVersionUID = 1L;
@NotNull
private String emailId;
@ManyToOne(fetch = FetchType.LAZY)
@NotNull
private Offer offer;
在 Offer 类映射中是在 jobTitle 上完成的。
@Repository
interface ApplicationRepository extends JpaRepository <Application,MyKey>
{
List<Application> findAllByMyKey_Offer(String jobTitle);
}
尝试这个但没有成功... 我想获取有关特定 jobTitle 的所有应用程序。 我在 ApplicationRepository 类中的方法名称应该是什么。
【问题讨论】:
标签: java spring spring-boot spring-data-jpa many-to-one