嵌套属性上的Spring Crud

时间:2014-12-17 10:27:33

标签: spring crud spring-data-jpa

我有一个spring crud存储库:

@Repository
public interface CrudCVVacancyMatchRepository extends CrudRepository<CVVacancyMatchEntity, Long> {

CVVacancyMatchEntity对象具有Vacancy属性。我试图在Vacancy属性的属性上编写查询方法。

以下查询方法正常工作(Vacancy有一个名为name的字符串属性):

Iterable<CVVacancyMatchEntity> findByVacancyName(String name);

Vacancy也有属性作为集合:

@ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@JoinTable(name = "vacancy_industries", joinColumns = { @JoinColumn(name = "fk_vacancy", referencedColumnName = "id") }, inverseJoinColumns = { @JoinColumn(name = "fk_industry", referencedColumnName = "id") })
private final Set<IndustryEntity> industries = Sets.newHashSet();

这不起作用:

Iterable<CVVacancyMatchEntity> findByVacancyIndustries(Set<IndustryEntity> industryEntities);

我得到ERROR SqlExceptionHelper:146 - Syntax error in SQL statement

select cvvacancym0_.id as id1_19_, cvvacancym0_.comment as comment2_19_, cvvacancym0_.cv_id as cv_id4_19_, cvvacancym0_.rating as rating3_19_, cvvacancym0_.user_id as user_id5_19_, cvvacancym0_.vacancy_id as vacancy_6_19_ from cv_vacancy_match cvvacancym0_ cross join vacancy vacancyent1_ cross join vacancy_industries industries2_, industry industryen3_ where cvvacancym0_.vacancy_id=vacancyent1_.id and vacancyent1_.id=industries2_.fk_vacancy and industries2_.fk_industry=industryen3_.id and .=? [42001-182]

有什么想法吗?

0 个答案:

没有答案