The compiler swears at me because of this line:

session.createCriteria(Bus.class).list(); 

In the source I see this:

 /** @deprecated */ @Deprecated Criteria createCriteria(Class var1); /** @deprecated */ @Deprecated Criteria createCriteria(Class var1, String var2); /** @deprecated */ @Deprecated Criteria createCriteria(String var1); /** @deprecated */ @Deprecated Criteria createCriteria(String var1, String var2); 

And what needs to be replaced is not clear. There are no links ...

  • In short - Jpa. I will not throw an example, because I am sure that my requests are crooked and incorrectly compiled. For he himself still understood this badly - Riĥard Brugekĥaim
  • The best curves are examples than sending in three letters (Jpa). :) - faoxis

1 answer 1

It's all very simple. The fact that you were sent in the direction of the JPA is nothing terrible :) in fact, this is the right direction. This API is marked deprecated because it is Hibernate-specific, and it is suggested to transfer it to pure JPA (so that at any time you have the opportunity to replace your ORM in the face of Hibernate with any other or native implementation). Here I found a description of this fact.