Scott Roehrig (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZWVmOThlZjQ1...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-14152?atlOrigin=eyJpIjoiZWVmOT...
) HHH-14152 (
https://hibernate.atlassian.net/browse/HHH-14152?atlOrigin=eyJpIjoiZWVmOT...
) Simple Query fails after upgrading to 5.4.20.Final (
https://hibernate.atlassian.net/browse/HHH-14152?atlOrigin=eyJpIjoiZWVmOT...
)
Issue Type: Bug Affects Versions: 5.4.20 Assignee: Unassigned Components: hibernate-core
Created: 12/Aug/2020 15:41 PM Environment: Windows platform Priority: Major Reporter:
Scott Roehrig (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
I have a simple query that is executed to retrieve a row from the database. This query
worked fine when run using HSQLDB in 5.4.19. The persistence.xml uses a create/load sql
scripts. After updating to 5.4.20, the query fails with No Entity Found now. The entity is
created during the load.sql execution. This only appears to happen when running with an in
memory HSQLDB also for some reason (which are what the automated unit tests use of
course)
I am uncertain what aspect of changes to 5.4.20 affected this. The entity hierachy is a
JOIN TABLE with PARENT/CHILD relationship. I will attach the class files below and the sql
files. I am unable to attach the entire source tree. But the query is a relatively simple
query that selects an entity (the child via the JOIN relationship) based upon one field of
a composiite primary key.
I will update as I can investigate this a bit more. I have tried to remove ALL comments
from the source sql files if perhaps the comment change has impacted this, but that
appears to not resolve it. I have tried to set parameter padding back to true to see if
that change affected it to no avail.
The failing named query is as follows : @NamedQuery(name = IssuerImpl.SELECT_BY_ISSUER,
query = "SELECT issuer FROM " + IssuerImpl.ENTITY_NAME + " issuer WHERE
issuer.identifier.issuer= :issuer")
Here the "issuer" entity is a subtype of the main "resource" entity
@Entity(name = ResourceImpl.ENTITY_NAME)
@Table(name = ResourceImpl.TABLE_NAME)
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = ResourceImpl.ENTITY_COLUMN) defines the parent and a secondary
JOIN table is used on the child
@Entity(name = IssuerImpl.ENTITY_NAME)
@SecondaryTable(name = IssuerImpl.TABLE_NAME, pkJoinColumns =
{ @PrimaryKeyJoinColumn(name = IdentifierImpl.ISSUER_COLUMN, referencedColumnName =
IdentifierImpl.ISSUER_COLUMN), @PrimaryKeyJoinColumn(name =
IdentifierImpl.IDENTIFIER_COLUMN, referencedColumnName = IdentifierImpl.IDENTIFIER_COLUMN)
}
)
@org.hibernate.annotations.Table(appliesTo = IssuerImpl.TABLE_NAME, optional = false)
The failure is seen via this simple lookup query final Issuer issuer = manager.find(new
IdentifierImpl(1L, "1") where the executed query is "SELECT DISTINCT
resource FROM " + this.clazz.getSimpleName() + " resource WHERE
resource.identifier = :identifier"; where entity name is inserted as IssuerImpl.
(
https://hibernate.atlassian.net/browse/HHH-14152#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-14152#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#100144- sha1:57e1ab7 )