JPQL: InnerSelect causes PersistenceException (HibernateException: Errors in named queries)

402 views Asked by At

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...

1

There are 1 answers

0
marabol On BEST ANSWER

The reason was visible on other output:

QuerySyntaxException: "Tablename is not mapped"

This error was logged and not available in the exception.