0

In my project we have extensively used hibernate criteria, which has now deprecated in newer releases. I tried to replace the same with the JPA criteria but faced some below mentioned issues:

Select query will be invoked for every sub-entities defined in the parent entity class. Correct joins are not in place, since in hibernate criteria we define everything in an entity class. By using fetch and join method we explicitly needs to define the entities till it's depth. Using graph we can define the depth of entities in the parent entity class. My question is when we already define in the entity class then why we needs to do these all extra things.

Please suggest the best solution on this, I didn't found any proper solution on this.

  • 1
    Does this answer your question? [Hibernate 5 - createCriteria deprecated](https://stackoverflow.com/questions/41773336/hibernate-5-createcriteria-deprecated) – Karim Jan 17 '20 at 16:00
  • No, we need to replace create criteria with the jpa criteria. As I mentioned above, that issues I faced while replacing with JPA criteria. – Nitin Jain Jan 18 '20 at 02:22
  • JPA criteria is a bit verbose there is no way around it unless you use something like QueryDSL – Karim Jan 19 '20 at 13:07
  • We have used extensively hibernate criteria, now to migrate everything in QUeryDSL will surely difficult and having huge effort involved in that. – Nitin Jain Jan 20 '20 at 10:29
  • That is if you want to avoid the boiler part of JPA criteria. – Karim Jan 20 '20 at 14:07

0 Answers0