After migrating from Hibernate version 5.6.15.Final to Hibernate 6.x, we encountered issues with our HQL queries that reference DB column names instead of object property names.
For e.g.
em.createQuery(“select id from Site where exclude = false”)
Site class
@Column(name = "exclude")
private boolean blockAccess;
In Hibernate 6.x, using the column name “exclude” in HQL queries fails due to “org.hibernate.query.SemanticException: Could not interpret path expression ‘exclude’.” It works after modifying it to use the object property name “blockAccess.”
Considering the substantial number of queries in our codebase relying on column names, is there any way to make it work without changing in each HQL?