Scott Roehrig (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *commented* on HHH-14152 (
https://hibernate.atlassian.net/browse/HHH-14152?atlOrigin=eyJpIjoiY2Q3Nm...
)
Re: Query fails after upgrading to 5.4.20.Final (
https://hibernate.atlassian.net/browse/HHH-14152?atlOrigin=eyJpIjoiY2Q3Nm...
)
Providing the source isn’t possible as it is commercially licensed code. I have been able
to debug this further and I may have narrowed the issue down. I wrote a second test case
as follows:
final EntityManager manager =
com.gemalto.ics.usplatform.bip.persistence.EntityManagerFactory.newInstance().createEntityManager();
{{try { }}
Query query = manager.createNativeQuery("SELECT IDENTIFIER FROM ISSUERS WHERE ISSUER
= 1 AND IDENTIFIER = '1'"); query.setHint(QueryImpl.QUERY_HINT_READ_ONLY,
true); List<Object> results = query.getResultList(); query =
manager.createNativeQuery("SELECT IDENTIFIER FROM RESOURCES WHERE ISSUER = 1 AND
IDENTIFIER = '1'"); query.setHint(QueryImpl.QUERY_HINT_READ_ONLY, true);
results = query.getResultList(); query = manager.createQuery( "SELECT DISTINCT
resource FROM IssuerImpl resource WHERE resource.identifier = :identifier");
query.setParameter("identifier", new
com.gemalto.ics.usplatform.bip.IdentifierImpl(1L, "1"));
query.setHint(QueryImpl.QUERY_HINT_READ_ONLY, true); results = query.getResultList();
{{} finally
{ manager.close();}
}}
What I found is interesting. The FIRST query which looks at the CHILD table ISSUERS finds
the ROW in 5.4.19/5.4.20. BUT, in 5.4.20 the parent table RESOURCES is missing the row
while it is not missing the row in 5.4.19. This only happens when the persistence.xml is
configured to create the tables and structure at runtime (in unit tests for instance). The
structure is created via a create.sql and a load.sql.
In 5.4.19 that function works correctly and the tables have the proper entries required
for the tests inserted via load.sql. In 5.4.20, they do not however. What is interesting
is there are FK relations across the ISSUERS table rows to the parent RESOURCES table as
it is a secondary JOIN table, but it is not being violated in 5.4.20.
So, I would hypothesize that something perhaps in the MultiLine extractor has changed? I
did notice there was a backport of a change in that area in 5.4.20 in the issues list.
But the problem appears to be on the “creation” side and not a regression in the actual
query itself. Which explains why the exact query works in 5.4.19 but fails in 5.4.20 which
was utterly confusing for a bit 🙂
I am going to see if I can convert to not using the multi line reader in persistence.xml
and if that makes any difference. But the issue appears to be related to the
creation/loading of the database via the persistence.xml and not the runtime query failing
so to speak.
(
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:b6d623e )