@JoinColumn as query param
I used jpa, mysql, eclipselink, spring 3. I have two tables in one-to-many
bidirectional relationship. I want to create qurey for @JoinColumn param
but I have an error:
No property save found for type foo.domain.Catalog
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287)
in my etities:
//bi-directional many-to-one association to Category
@ManyToOne()
@JoinColumn(name="cname", referencedColumnName="name")
private Category category;
//bi-directional many-to-one association to Catalog
@OneToMany(targetEntity=Catalog.class, mappedBy="category",
cascade={CascadeType.ALL}, fetch = FetchType.EAGER)
private List<Catalog> catalog;
query in repository:
@Query("select c from Catalog c where c.category = :cname")
public List<Catalog> takeByCategoryName(Category cname);
I don't know what is going on? Thanks for help.
No comments:
Post a Comment