SqmCteRoot.toString() always produces NullPointerException

Description

org.hibernate.query.sqm.tree.domain.SqmCteRoot extends org.hibernate.query.sqm.tree.from.SqmRoot and inherits the toString() method from it.

The toString() method calls getEntityName() which in turn calls getModel().getHibernateEntityName().

But SqmCteRoot overrides getModel() and returns null.

which causes the toString() method to always fail with a java.lang.NullPointerException.

I noticed this when I changed my log level to TRACE and org.hibernate.query.hql.internal.DomainPathPart.resolvePathPart() tried to log a SqmCteRoot object.

I think that a workaround could be to override the toString() method as well.

It is hard for me to construct a test case because I am not sure what toString() should produce.

Activity

Show:

Andrea Boriero February 26, 2024 at 1:16 PM

Hi ,

thanks for checking. i’m going to close this Jira.

Thomas Völk February 26, 2024 at 1:01 PM

Andrea Boriero January 29, 2024 at 12:07 PM

Hi ,

we just need a reproducer that throws the NullPointerException.

You can use our test case template: https://github.com/hibernate/hibernate-test-case-templates/blob/master/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java to create a reproducer.

 

Thanks.

Out of Date

Details

Assignee

Reporter

Components

Affects versions

Priority

Created September 8, 2023 at 2:58 PM
Updated February 26, 2024 at 1:16 PM
Resolved February 26, 2024 at 1:16 PM