Я пытаюсь выполнить эту следующую JPQL:JPQL запрос с ManyToMany
@Query("select o from Offre o where o.typeContrat.titre=:a or o.ville.nomVille=:b or o.competences.libelleCompetance = :c")
public Page<Offre> offresSearch(@Param("a") String type, @Param("b") String location, @Param("c") String competence,Pageable pageable);
и это мое Offre лицо:
@Entity
public class Offre implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "CODE_OFFRE")
private Long codeOffre;
private String titre;
@Lob
private String description;
@ManyToOne
@JoinColumn(name="codeContratType")
private TypeContrat typeContrat;
@ManyToMany
@JoinTable(name="OFFRE_COMP",
[email protected](name="CODE_OFFRE"),
[email protected](name="CODE_COMPETENCE"))
private List<Competence> competences;
// Getters and setters
и это моя компетенция лицо:
@Entity
public class Competence implements Serializable {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name = "CODE_COMPETENCE")
private Long codeCompetence;
private String libelleCompetance;
@ManyToMany(mappedBy="competences")
private Collection<Offre> offres;
// Getters, Setters
@JsonIgnore
@XmlTransient
public Collection<Offre> getOffres() {
return offres;
}
@JsonSetter
public void setOffres(Collection<Offre> offres) {
this.offres = offres;
}
}
, но когда я запускаю свое приложение, я получаю эту ошибку:
java.lang.IllegalArgumentException: org.hibernate.QueryException: незаконной попыткой сбора разыменовывания [offre0_.code_offre.competences] со ссылкой элемент собственности [libelleCompetance] [выбрать из о com.capValue.Rekrute.entities. Offre o где o.typeContrat.titre =: a или o.ville.nomVille =: b или o.competences.libelleCompetance =: c] at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert (AbstractEntityManagerImpl.java: 1750) ...
Возможно, вам нужно будет явно подключиться вместо сверления ссылок. – BPS