I try to use an inner select, but get only the exception "HibernateException: Errors in named queries"
The both JPA entities:
public class A implements Serializable {
@Id
@Column(nullable = false)
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
}
public class B implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@JoinColumn(name = "FK_A_ID", nullable = true)
@ManyToOne
private A a;
}
This query causes the exception:
SELECT a FROM A a WHERE a.id NOT IN (SELECT b.a.id FROM B b)
But this causes no exception:
SELECT a FROM A a WHERE a.id NOT IN (1, 2, 3)
Any idea what is wrong? Thanks a lot...