Hello there.
I am trying to work out how to get this condition to work, but I can’t seem to figure it out. I have a bit of JPQL that looks like this:
<loader id="publicHolidaysDl">
<query>
<![CDATA[select ph from kipper_PublicHoliday ph,
kipper_Person p,
kipper_PersonPostalAddress ppa,
kipper_PostalAddress pa,
kipper_Country c]]>
<condition>
<c:jpql>
<c:where>
p = :container_personDc
and ppa.person = p
and ppa.defaultAddress = true
and ppa.postalAddress = pa
and pa.country.id = c.id
and c.id = ph.country.id
</c:where>
</c:jpql>
</condition>
<condition>
<c:jpql>
<c:where>
c.id = :country_id
</c:where>
</c:jpql>
</condition>
</query>
</loader>
I want the first condition to execute when the page loads (which seems to work okay), but when I change the value in a table, I want the second condition to execute, which it doesn’t do:
@Subscribe(id = "personPostalAddressesDc", target = Target.DATA_CONTAINER)
private fun onPersonPostalAddressesDcItemPropertyChange(event: InstanceContainer.ItemPropertyChangeEvent<PersonPostalAddress>) {
if (event.property == "defaultAddress"
&& event.prevValue == false
&& event.value == true) {
val country = event.item.postalAddress?.country
if (country != null) {
publicHolidaysDl.setParameter("country_id", country.id)
publicHolidaysDl.load()
}
}
}
But all I get is this error message:
DevelopmentException: Parameter 'country_id' is not used in the query
How do I get it to trigger the second condition?