这是我的两个pojo字段
@ManyToMany
@Cascade(value = SAVE_UPDATE)
@JoinTable(name = "catalogToCatalog",
joinColumns = {@JoinColumn(name = "parentId",
foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))},
inverseJoinColumns = {@JoinColumn(name = "childId",
foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))})
private List<Catalog> parents;
@Cascade(value = SAVE_UPDATE)
@ManyToMany(mappedBy = "parents", fetch = FetchType.EAGER, targetEntity = Catalog.class)
private List<Catalog> children;
如何使用
这样的命名查询获取数据"from Catalog c left join c.parents p " +
"where p.parentId = :parentId";
?
QueryException: could not resolve property: parentId of: com.x.model.Catalog [from com.x.model.Catalog c left join