qg_java_17137
qg_java_17137

Reputation: 3569

Where to find the deprecated method's alternative method in IntelliJ IDEA?

I have a question, if I write code in IntelliJ IDEA, when I encounter a method I want to invoke, but find it is deprecated. But the IntelliJ IDEA did not have a alert information refer to find the alternative method, how can I know the alternative method where is?

enter image description here

My code maybe help to my question:

sessionFactory.getCurrentSession().createQuery("from Admin where admin_name=? and pwd=?").setString();

I run into the Query.class, there is no statement for alternatime method too.

enter image description here

Upvotes: 0

Views: 2407

Answers (1)

SergGr
SergGr

Reputation: 23788

Idea can't help you because you work with decompiled sources and there is no additional information there. If you select "Download..." in the yellow toolbar at the top, you most probably get the actual sources of your Hibernate and you'll see something like what I see at the latest GitHub version of Query.java or another Query.java both of which in the JavaDoc just above the corresponding method say

 * @deprecated (since 5.2) use {@link #setParameter(int, Object)} or {@link #setParameter(int, Object, Type)}
 * instead

As for why those methods were deprecated, I think the Migration Guide 5.2 provides some insights:

Lots of work has been done for 6.0. One of the things 6.0 will need is a unified view of "type systems" including its own type system (Type, EntityPersister, CollectionPersister, etc) and JPA’s type system - which would mean unifying all of this in hibernate-core. Because of this and the other large changes slated for 6.0 we decided to release a 5.2 that showed a clear migration path to the changes in 6.0 but that still supported the older calls and expectations as much as possible.

Upvotes: 1

Related Questions