Hi,
we’ve been on 6.2.14 and we’re updating to 6.4.2. We have a HQL query that looks like below. Should the simple query like this be translated to subselect instead of simple inner join? Also dirty checking on second table doesn’t work because the querySpace is different for the joined table. It worked fine for hibernate 5 and 6.2.14, with subselect dirty checking is broken.
In 6.4.2 autoFlush querySpaces are SITE_AGREEMENT
and second is (select * from SUPPLIER_PROFILE t where t.TYPE='COMMUNITY')
.
In 6.2.14 autoFlush querySpaces are SITE_AGREEMENT
and second SUPPLIER_PROFILE
.
SUPPLIER_PROFILE is entity with SINGLE_TABLE inheritance, one of the types is COMMUNITY.
select siteAgreementImpl
from SiteAgreementImpl siteAgreementImpl
inner join siteAgreementImpl.communitySupplierProfile as communitySupplierProfileImpl
where siteAgreementImpl.communitySite = 1 and communitySupplierProfileImpl.businessNumber = "ZZZ"
And in Hibernate 6.4.2 this query is translated to
select ... from SITE_AGREEMENT sai1_0 join (select * from SUPPLIER_PROFILE t where t.TYPE='COMMUNITY') csp1_0 on csp1_0.ID=sai1_0.COMMUNITY_SUPPLIER_PROFILE_ID where sai1_0.COMMUNITY_SITE_ID=1 and csp1_0.BUSINESS_NUMBER="ZZZ"
In 6.2.14, the same query translated to
select ... from SITE_AGREEMENT s1_0 join SUPPLIER_PROFILE c1_0 on c1_0.ID=s1_0.COMMUNITY_SUPPLIER_PROFILE_ID where s1_0.COMMUNITY_SITE_ID=1 and c1_0.BUSINESS_NUMBER="ZZZ"