I have a (oracle)table with about 5 million records and a quite complex query which returns about 5000 records of it in less than 5 seconds with a database tool like toad. However when I ran the query via entityManager(eclipseLink) the query runs for minutes...
I'm probably too naive in the implementation. I do:
Query query = em.createNativeQuery(complexQueryString, Myspecific.class); ... setParameter... List result = query.getResultList();
The complexQueryString starts with a "SELECT *".
What kinds of optimization do I have? May be one is only to select the fields I really need later. Some explanation would be great.