Sauli Anto (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *updated* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNjI4N2JjZTY5...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16119?atlOrigin=eyJpIjoiNjI4N2...
) HHH-16119 (
https://hibernate.atlassian.net/browse/HHH-16119?atlOrigin=eyJpIjoiNjI4N2...
) Named native queries do not work with jakarta.persistence.Tuple result class (
https://hibernate.atlassian.net/browse/HHH-16119?atlOrigin=eyJpIjoiNjI4N2...
)
Change By: Sauli Anto (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
Named native queries do not work with {{jakarta.persistence.Tuple}} return class. E.g.
calling {{entityManager.createNamedQuery("Demo.findAllCustom", Tuple.class);}}
in the test case, it causes following NullPointerException:
{noformat}Cannot invoke "String.toLowerCase()" because "aliases[i]" is
null
java.lang.NullPointerException: Cannot invoke "String.toLowerCase()" because
"aliases[i]" is null
at
org.hibernate.jpa.spi.NativeQueryTupleTransformer$NativeTupleImpl.<init>(NativeQueryTupleTransformer.java:79)
at
org.hibernate.jpa.spi.NativeQueryTupleTransformer.transformTuple(NativeQueryTupleTransformer.java:29)
at
org.hibernate.jpa.spi.NativeQueryTupleTransformer.transformTuple(NativeQueryTupleTransformer.java:25)
at
org.hibernate.sql.results.internal.RowTransformerTupleTransformerAdapter.transformRow(RowTransformerTupleTransformerAdapter.java:30)
at
org.hibernate.sql.results.internal.StandardRowReader.readRow(StandardRowReader.java:109)
at
org.hibernate.sql.results.spi.ListResultsConsumer.consume(ListResultsConsumer.java:198)
at org.hibernate.sql.results.spi.ListResultsConsumer.consume(ListResultsConsumer.java:33)
at
org.hibernate.sql.exec.internal.JdbcSelectExecutorStandardImpl.doExecuteQuery(JdbcSelectExecutorStandardImpl.java:443)
at
org.hibernate.sql.exec.internal.JdbcSelectExecutorStandardImpl.executeQuery(JdbcSelectExecutorStandardImpl.java:166)
at
org.hibernate.sql.exec.internal.JdbcSelectExecutorStandardImpl.list(JdbcSelectExecutorStandardImpl.java:91)
at org.hibernate.sql.exec.spi.JdbcSelectExecutor.list(JdbcSelectExecutor.java:31)
at
org.hibernate.query.sql.internal.NativeSelectQueryPlanImpl.performList(NativeSelectQueryPlanImpl.java:105)
at org.hibernate.query.sql.internal.NativeQueryImpl.doList(NativeQueryImpl.java:602)
at org.hibernate.query.spi.AbstractSelectionQuery.list(AbstractSelectionQuery.java:363)
at org.hibernate.query.Query.getResultList(Query.java:94)
at
com.example.demo.DemoApplicationTests.testNamedNativeQueries3(DemoApplicationTests.java:57){noformat}
Test case:
[
https://github.com/isaul32/spring-data-jpa-named-native-query-bug|https:/...]
Working test case (Hibernate 5):
[
https://github.com/isaul32/spring-data-jpa-named-native-query-bug/pull/1|...]
(
https://hibernate.atlassian.net/browse/HHH-16119#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16119#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100214- sha1:d3cc1a2 )