Andrei Nikulin (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *updated* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYmY0ODUzMGVh...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-17038?atlOrigin=eyJpIjoiYmY0OD...
) HHH-17038 (
https://hibernate.atlassian.net/browse/HHH-17038?atlOrigin=eyJpIjoiYmY0OD...
) Error executing query in H6.2.7 (InterpretationException) (
https://hibernate.atlassian.net/browse/HHH-17038?atlOrigin=eyJpIjoiYmY0OD...
)
Change By: Andrei Nikulin (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
I have an issue migrating some code to Hibernate 6.2 from 5,
and get an exception saying
{{org.hibernate.query.sqm.InterpretationException: Error interpreting query [from
UserTranslation where classifier.id=?1]; this may indicate a semantic (user query) problem
or a bug in the parser [from UserTranslation where classifier.id=?1]}}
The model is as follows:
{code:java}@MappedSuperclass
public abstract class AbstractEntity<ID> {
public abstract ID getId();
}
@Entity
@Table(name = "USERS")
public class User extends AbstractEntity<Long> implements WithTranslationKey {
@Id
@GeneratedValue
private Long id;
private String name;
/* boilerplate..... */
}
@MappedSuperclass
public abstract class AbstractTranslationEntity<T extends AbstractEntity<Long>
& WithTranslationKey>
extends AbstractEntity<Long> {
@Id
@GeneratedValue
private Long id;
@JoinColumn(name = "CLASSIFIER_ID", nullable = false)
@ManyToOne(fetch = FetchType.LAZY, optional = false)
private T classifier;
@Column(name = "LOCALE_CODE", length = 15, nullable = false)
private String localeCode;
/* boilerplate..... */
}
@Entity
@Table(name = "USER_TRANSLATION")
public class UserTranslation extends AbstractTranslationEntity<User> {
private String translation;
/* boilerplate..... */
}{code}
The failing query is:
{noformat}List<?> resultList = entityManager.createQuery("from UserTranslation
where classifier.id=?1")
.setParameter(1, user1.getId())
.getResultList();{noformat}
Passing test with Hibernate 5 dependency: [Branch
h5-passing|https://github.com/NikulinAndrei/spring-boot-3-test/tree/h5-pa...]
Failing test with Hibernate 6 dependency: [Branch
h6-failing|https://github.com/NikulinAndrei/spring-boot-3-test/tree/h6-fa...]
the failing test name is {{shouldQueryUserTranslations}}
(
https://hibernate.atlassian.net/browse/HHH-17038#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-17038#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#100233- sha1:2faa3a6 )