Hi all,
I need some help for a native query in JPA using Hibernate.
I have a JPA query as follows:
Code:
entityManager.createQuery("from myTableA a JOIN FETCH myTableB");
Hibernate generates exactly ONE SQL statement out of the query as expected.
When I use a native query as
Code:
entityManager.createNativeQuery("select * from MY_TABLE_A a JOIN MY_TABLE_B b ON a.fk_id = b.id", MyTableA.class);
Hibernate generates the query above and n queries for the related table MY_TABLE_B although it is joined.
Do I have any possibility to prevent hibernate from doing the n additional queries which should normally be useless?
Thanks in advance,
Pascal