QueryException: could not resolve property: parentId of: com.x.model.Catalog

 
 
 
Сообщения:141
Привет! Ребята, можете помочь? Сорри, что на англ.
Here is my two pojo fields

@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;
How I could get data with named query like

"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
 
 
Сообщения:48
what the name of @id filed?
if "id" then query code must be
from Catalog c left join c.parents p 
where p.id = :parentId
 
Модераторы:Нет
Сейчас эту тему просматривают:Нет