Clarification of org.hibernate.query.Query methods

Description

Several methods in the interface org.hibernate.query.Query are inherited from the @Deprecated org.hibernate.Query interface, but are not marked as deprecated in org.hibernate.Query and not @Override in org.hibernate.query.Query. These include scroll() and setParameterList(). When used, these methods are flagged as Deprecated by the compiler due to their declaration in org.hibernate.Query. However, these are still used internally by non-deprecated methods in AbstractProducedQuery, and scroll() does not have a non-deprecated equivalent.

If these are not deprecated, please @Override them in org.hibernate.query.Query. If they are, please add deprecation notes in the javadoc for replacements.

Environment

None

Activity

Show:
Andrea Boriero
July 19, 2016, 11:49 AM

Hi ,

I think methods like org.hibernate.Query#setParameterList() should be overridden by org.hibernate.query.Query in order to not return the deprecated org.hibernate.Query.

For the scroll() method it is not flagged as deprecated by the compiler.

Will Darby
July 19, 2016, 2:24 PM

The problem is that both setParameterList() and scroll() are defined on the deprecated org.hibernate.Query not org.hibernate.query.Query. Therefore the definition is from the Deprecated interface.

This is this the warning I am receiving from the Oracle/Sun JDK 1.8:
The method scroll(ScrollMode) from the type Query<PjmRtAvgBucket> is deprecated

The method needs to be overridden in the org.hibernate.query.Query() for the deprecation warning to be resolved, as setMaxResutls()

Andrea Boriero
July 19, 2016, 3:21 PM

,

Are you calling setParameterList() and then setMaxresults() and scroll()?

Will Darby
July 19, 2016, 6:13 PM

Here's an example of the warning using the session directly:

I also get the warning using:

and

Vlad Mihalcea
July 21, 2016, 9:33 AM

I added all your examples to a test method and committed it as well.

Then, I activated -Xlint in Gradle:

I run the test in question:

And this is the actual output:

As you can see, there are warning, but not for CriteriaCompilingTest.

I'm also using Oracle JDK:

Can you paste the output that you get when running this test?

Assignee

Andrea Boriero

Reporter

Will Darby

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Minor
Configure