【发布时间】:2020-06-07 00:48:11
【问题描述】:
我在三个对象之间有以下关系
public class ProductEntity {
@Id
private int id;
@OneToMany(mappedBy = "productEntity",
fetch = FetchType.LAZY)
private List<ProductInfoEntity> productInfoEntityList = new ArrayList<>();
@Column(name = "snippet")
private String snippet;
}
public class ProductInfoEntity {
@Id
private int id;
@ManyToOne
@JoinColumn(name = "product_id")
private ProductEntity productEntity;
@ManyToOne
@JoinColumn(name = "support_language_id")
private SupportLanguageEntity supportLanguageEntity;
}
public class SupportLanguageEntity {
@Id
private int id;
@Column("name")
private String name;
}
那么,我想制定一个规范来查询如下:
从产品信息中选择 * 其中product_id = 1 和 support_language_id = 2;
我也在为规范使用注解,这意味着我使用 ProductEntity_、ProductInfoEntity_ 等。
能否请您给我上述查询规范的完整工作代码?
谢谢大家
【问题讨论】:
-
抱歉,SO 不是编码服务。我们不会为您编写代码。但是,如果您尝试过某事但无法使其发挥作用,请告诉我们您尝试了什么,它是如何无效的,我相信有人会给出如何继续的提示。
-
感谢您纠正我,但我什至不知道如何做到这一点。我已经搜索了 SO,但找不到我的问题的答案。那么,你能给我一些提示吗?
标签: mysql spring-mvc jpa spring-data-jpa specifications