[hibernate-issues] [JIRA] (HHH-14152) Query fails after upgrading to 5.4.20.Final

Scott Roehrig (JIRA) jira at hibernate.atlassian.net
Thu Aug 13 11:15:50 EDT 2020


Scott Roehrig ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A6aeea1e9-2b04-4966-85d3-f9a21217d3dc ) *commented* on HHH-14152 ( https://hibernate.atlassian.net/browse/HHH-14152?atlOrigin=eyJpIjoiY2Q3NmQ4YzgzN2I3NDA1NGFkZGUxZDBiODRjZmQ0M2EiLCJwIjoiaiJ9 )

Re: Query fails after upgrading to 5.4.20.Final ( https://hibernate.atlassian.net/browse/HHH-14152?atlOrigin=eyJpIjoiY2Q3NmQ4YzgzN2I3NDA1NGFkZGUxZDBiODRjZmQ0M2EiLCJwIjoiaiJ9 )

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=eyJpIjoiY2Q3NmQ4YzgzN2I3NDA1NGFkZGUxZDBiODRjZmQ0M2EiLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-14152#add-comment?atlOrigin=eyJpIjoiY2Q3NmQ4YzgzN2I3NDA1NGFkZGUxZDBiODRjZmQ0M2EiLCJwIjoiaiJ9 )

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.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100144- sha1:b6d623e )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200813/3abe2c33/attachment.html 


More information about the hibernate-issues mailing list