HI,
I have an entity that has many to one relationship with other entities and that then having relationship hierarchy inside them.
So While running the query containing that entity ,it is going to fetch all nested entities and taking too much time. While executing query in database it is few miliseconds. But with Hibernate (When record numbers is 1000 or more ) it is taking at least 15 minute to just fetch data from database. The query is a simple sql query.
SELECT * FROM customerOfferPurchase WHERE dateCancelled >= :firstDay AND dateCancelled <= :endDay AND customerId NOT IN( SELECT customerId FROM customerOfferPurchase WHERE customerOfferPurchaseStatus =2 ) ORDER BY id DESC";
simply to fetch data on the basis of two dates.
Please any body tell me how to kill this delay.
Thanks in advance.
|