views:

66

answers:

1

Hi

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

A: 

The reason was visible on other output:

QuerySyntaxException: "Tablename is not mapped"

This error was logged and not available in the exception.

marabol