Native query is faster than HQL/Criteria query in Hibernate
问题 I have a table which has partition on daily basis. When I used query through HQL/Criteria, it took 240 sec to get the results in Hibernate. The same query(native query created by Hibernate) took 2sec when I used directly or through JDBC connection. Note: The native query has taken less than 2 sec from postgres db(direct firing). Please reply where might be the problem Here is the Entity with Named Query: import java.io.Serializable; import java.sql.Timestamp; import javax.persistence.Column;