You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Auto assignments with target filter queries like "type.id=not=XYZ" doesn't match targets without target type (with EclipseLink only) #2758
I have 4 devices: 2 of type NOT_XYZ and 2 without type.
I create target filter with "type.id=not=XYZ" and assign a distribution set (compatible with all devices)
Expected: all 4 devices should be involved
Result: only these of type NOT_XYZ are involved. Targets without type are not.
After some debug:
this behavior is observed with EclipseLink JPA provider only. With Hibernate it seems as expected - so, it seems the bug comes from there
JpaTargetManagement.findByTargetFilterQueryAndNonDSAndCompatibleAndUpdatable creates the following SQL queries:
# EclipseLinkSELECT DISTINCT*FROM sp_target t1
LEFT OUTER JOIN sp_target_type t0 ON (t0.id=t1.target_type)
LEFT OUTER JOIN (sp_target_type_ds_type t4 JOIN sp_distribution_set_type t2 ON (t2.id=t4.distribution_set_type)) ON (t4.target_type=t0.id),
sp_target_type t3
WHERE (((((t3.id IS NULL) OR (t1.target_type<> ?)) AND ((t1.target_type IS NULL) OR (t2.id= ?))) AND (t1.tenant= ?)) AND ((t3.id=t1.target_type) AND (t3.tenant= ?))) LIMIT ?, ?
# Hibernateselect distinct*from sp_target jt1_0
left join sp_target_type tt1_0 ontt1_0.id=jt1_0.target_typeandtt1_0.tenant= ?
left join sp_target_type tt2_0 ontt2_0.id=jt1_0.target_typeandtt2_0.tenant= ?
left join sp_target_type_ds_type dst1_0 ontt2_0.id=dst1_0.target_typewherejt1_0.tenant= ? and (tt1_0.id is nullortt1_0.id<>?) and (jt1_0.target_type is nullordst1_0.distribution_set_type=?) limit ?,?
from the EclipseLink query it seems that the problem is that (t3.tenant = ?) check requires that there is a target type available
so, it seems that it is related to EclipseLink and its tenancy support
PS: added a PR with a tests that shows that behavior - #2759 -> TargetManagementSearchTest#shouldFindTargetsWithoutTypeByTypeIdNot
I'd like to investigate and work on the underlying EclipseLink issue reported here.
I noticed that PR #2759 added the test case demonstrating the behavior, but the underlying query issue still appears unresolved.
I plan to investigate the query generation in JpaTargetManagement, particularly the interaction between target-type joins and tenant filtering, and propose a fix that preserves tenant isolation.
Hi @Basavaraj8143,
this issue was created to keep us aware of this EclipseLink behaviour. The test (TargetManagementSearchTest#shouldFindTargetsWithoutTypeByTypeIdNot) was made to notify us if EclipseLink fix it eventually - if they fix it - it will fail.
The test still passed so it seems it is still valid.
What's open for contribution regarding this issue on our side is eventually to find out a workaround to serve such kind of filters in proper manner. However, if this is an issue in EclipseLink (and Hibernate behaviour is the correct one) the best possible resolution would be to be fixed in EclipseLink - not workaround here.
Activity
[eclipse-hawkbit#2758] Add test for JpaTargetManagment - findByTarget…
[#2758] Add test for JpaTargetManagment - findByTargetFilterQueryAndN…
Basavaraj8143 commentedon Nov 8, 2026
Hi @avgustinmm,
I'd like to investigate and work on the underlying EclipseLink issue reported here.
I noticed that PR #2759 added the test case demonstrating the behavior, but the underlying query issue still appears unresolved.
I plan to investigate the query generation in
JpaTargetManagement, particularly the interaction between target-type joins and tenant filtering, and propose a fix that preserves tenant isolation.Is this issue still open for contributions?
Thanks!
avgustinmm commentedon Nov 9, 2026
Hi @Basavaraj8143,
this issue was created to keep us aware of this EclipseLink behaviour. The test (TargetManagementSearchTest#shouldFindTargetsWithoutTypeByTypeIdNot) was made to notify us if EclipseLink fix it eventually - if they fix it - it will fail.
The test still passed so it seems it is still valid.
What's open for contribution regarding this issue on our side is eventually to find out a workaround to serve such kind of filters in proper manner. However, if this is an issue in EclipseLink (and Hibernate behaviour is the correct one) the best possible resolution would be to be fixed in EclipseLink - not workaround here.