简体   繁体   中英

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?

在此处输入图片说明

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.

在此处输入图片说明

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM