I have two entities
@Entity
@Table(name="one")
public class One implements Serializable {
@Id
@NotNull
@Column(name = "id")
private String id;
@Column(name = "name")
private String name;
@Column(name = "title")
private String title;
@ManyToOne
@JoinColumn(name = "three_id")
private Three three;
}
@Entity
@Table(name="two")
public class Two implements Serializable {
@Id
@NotNull
@Column(name = "id")
private String id;
@Column(name = "order")
private String order;
@ManyToOne
@JoinColumn(name = "three_id")
private Three three;
}
@Entity
@Table(name="three")
public class Three implements Serializable {
@Id
@NotNull
@Column(name = "id")
private String id;
@Column(name = "quantity")
private String quantity;
}
And a named query as
select o.name from one o, two tw, three th where tw.order="test" and o.three.id = tw.three.id;
Jboss throws following error when deploying this org.hibernate.HibernateException: Errors in named queries
The intention is I want rows from two tables based on the common column three_id which is the id field in table "three" Why is it failing and how can I fix this.