Reputation: 63
Query query=entityManager.createQuery("Select e from StudentQualification e where e.student=:id");
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private Integer id;
@ManyToOne
@JoinColumn(name="student_id")
private Student student;
@ManyToOne
@JoinColumn(name="qualification_type")
private QualificationType qualificationType;
@Column(name="obtain_marks")
private Integer obtainMarks;
@Column(name="total_marks")
private Integer totalMarks;
@Column(name="institute")
private String institute;
@Column(name="year_of_completion")
Error on query excution: Parameter value [1] did not match expected type [com.autosoft.fortune.model.Student (n/a)] my query is above and after that my class attribute what should i do
Upvotes: 0
Views: 31
Reputation: 37023
i am also doing this"query.setParameter("id", studentId);" in my next line of code
See that what your SQL is :
Select e from StudentQualification e where e.student=:id"
^^^^^^^^^
e.student is of type Student private Student student;
and not simple integer.
So supply student object with id populated to query instead of id.
Upvotes: 1