在以下实体类中,从数据库如何编写查询以从表中进行选择 使用集合productsCollection2作为参数并检索productsCollection3。??? 我可以使用productCollection2并使用IN子句将列表传递给它。
@Table(name = "Products")
public class Products implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@Column(name = "SKU")
private String sku;
@Basic(optional = false)
@Column(name = "ProductName")
private String productName;
private boolean allowPreOrder;
@ManyToMany(mappedBy = "productsCollection")
private Collection<Categories> categoriesCollection;
@JoinTable(name = "Products_CrossSell", joinColumns = {
@JoinColumn(name = "SKU", referencedColumnName = "SKU")}, inverseJoinColumns = {
@JoinColumn(name = "CrossSKU", referencedColumnName = "SKU")})
@ManyToMany
private Collection<Products> productsCollection;
@ManyToMany(mappedBy = "productsCollection")
private Collection<Products> productsCollection1;
@JoinTable(name = "Products_Related", joinColumns = {
@JoinColumn(name = "SKU", referencedColumnName = "SKU")}, inverseJoinColumns = {
@JoinColumn(name = "RelatedSKU", referencedColumnName = "SKU")})
@ManyToMany
private Collection<Products> productsCollection2;
@ManyToMany(mappedBy = "productsCollection2")
private Collection<Products> productsCollection3;