0

According to documentation I have to use createQuery(String, Class), createSelectionQuery(), or createMutationQuery() instead of deprecated createQuery(String). But all of them doesn't fit.

1

Would you tell me what exactly method shoul I use for this query? Thank you in advance.

I haven't found this information on internet.

UPD: Should I use Criteria API in this case?

OleksiiUA
  • 1
  • 2
  • check this https://stackoverflow.com/questions/38460764/hibernate-5-2-version-a-lot-of-query-methods-deprecate and this one too https://discourse.hibernate.org/t/sqlquery-and-org-hibernate-query-are-deprecated-what-to-use-instead/1179 – Ryuzaki L Mar 14 '23 at 16:33
  • In the first case there is being used exactly createQuery that I try to workaround as deprecated, in the second there is being used createNativeQuery that although works but is deprecaed as well. – OleksiiUA Mar 15 '23 at 12:27

1 Answers1

1

The deprecation notice in the Javadoc actually points to createMutationQuery, but if you are using JPA APIs i.e. jakarta.persistence.EntityManager, then you can continue using that method.

Christian Beikov
  • 15,141
  • 2
  • 32
  • 58