Sauli Anto (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiOGY3N2VmNThh...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16119?atlOrigin=eyJpIjoiOGY3N2...
) HHH-16119 (
https://hibernate.atlassian.net/browse/HHH-16119?atlOrigin=eyJpIjoiOGY3N2...
) Named native queries do not work with jakarta.persistence.Tuple result class (
https://hibernate.atlassian.net/browse/HHH-16119?atlOrigin=eyJpIjoiOGY3N2...
)
Issue Type: Bug Affects Versions: 6.1.6 Assignee: Unassigned Created: 30/Jan/2023 09:24 AM
Environment: Hibernate: 6.1.6
H2 Database Engine: 2.1.214
Spring Data JPA: 3.0.1
Spring Boot: 3.0.2
JDK: Eclipse Temurin 17 LTS
OS: macOS 13 Priority: Blocker Reporter: 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:
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)
Test case:
https://github.com/isaul32/spring-data-jpa-named-native-query-bug (
https://github.com/isaul32/spring-data-jpa-named-native-query-bug )
Working test case (Hibernate 5):
https://github.com/isaul32/spring-data-jpa-named-native-query-bug/pull/1 (
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 )