Can someone explain why does Hibernate generate different aliases for the same query?(ABC1_25, ABC1_27 ...)
How can Hibernate be configured to reuse the same queries with same aliases? How can the query be cached or made optimal?
The application I am working with is generating same queries with different aliases as shown below:
SELECT abc0_.ATTR_ID AS ABC1_25_,
abc0_.ALLOW AS ALLOW2_25_,
abc0_.ALTER_DATE AS ALTER3_25_,
abc0_.CREATE_DATE AS CREATE6_25_,
FROM ABCTABLE abc0_
WHERE abc0_._ID = :1
SELECT abc0_.ATTR_ID AS ABC1_27_,
abc0_.ALLOW AS ALLOW2_27_,
abc0_.ALTER_DATE AS ALTER3_27_,
abc0_.CREATE_DATE AS CREATE6_27_,
FROM ABCTABLE abc0_
WHERE abc0_._ID = :1
This is causing processor and memory consumption.
I came across this link: Hibernate produce different SQL for every query but did not find an answer.