User declaration:
@Entity
public class User {
@Id
@GeneratedValue
private Integer id;
....
Pattern declaration:
<
You need to modify your query as follows:
from UserPattern where user.id = :user_id and pattern.id = :pattern_id
In your query, you are trying to match a User
object with an Integer
object.
i think maybe your annotation should be
@ManyToOne(TargetEntity=....class)
What happens if you change your HQL query to from UserPattern where user.id = :user_id and pattern.id = :pattern_id
?
I think Hibernate is confusing objects and ID fields.
If your field name is "id", your getter and setter methods should be named
public Integer getId(){return id;}
public void setId(Integer id){this.id = id};
If your are using Eclipse, generate the getter/setter by right click -> Source -> Generate Getters and Setters...
Make sure your getters and setter are public. Also you should add @Table-Annotation to all your Entities