JPQL Extensions :session doesn't work?

Hi!
First time I tried to filter a screen data loader with:

[CDATA[select e from PATIENT_DATA e where (e.height < 180.0) ]

That works fine. But for :session_ data:

[CDATA[select e from PATIENT_DATA e where (e.height < :session_PatientHeight) ]

it does not work, though I of course previously set:
sessionData.setAttribute(“PatientHeight”, 180.0);

Is any little thing missing?

Second observation:
I tried to set the described :session_ filter via a RowLevel policy. That works, again! So what’s needed in a screen descriptor, to use :session?

Thanks for ideas,
br
HP

Hi

How do you get sessionData instance in your controller?
It should be obtained via ObjectProvider as it shown in docs example: JPQL Extensions :: Jmix Documentation
Also make sure that data loader loads data after the attribute was set for SessionData

ok, will try. I set the sessionData in another screen before.
So there’s no ObjectProvider in the Screen with the loader.
The docs example made me assume, that only for setting sessiondata, the objectProvider would be needed… sorry…

My mistake.

This wrapping into ObjectProvider needed only when injecting to some singleton bean. In UI controller it can be injected directly. Authentication :: Jmix Documentation.

hi,
yepp, saw that, too.
As by now it works inside a rowlevel policy, which is by the way the better solution for me.

But I’ll shortly need UI loader nested :session_ tags again, so there’ll be further tests coming up…

thanks for your hints :slight_smile:
HP

Hi Hans-Peter,

Most probably your loader is not triggered at all because of this issue: DataLoadCoordinator doesn't trigger reload if a query contains a single session attribute parameter · Issue #1412 · jmix-framework/jmix · GitHub

Add this code to your controller:

@Subscribe
public void onBeforeShow(final BeforeShowEvent event) {
    patientDataDl.load();
}

Regards,
Konstantin

1 Like

Thank you Konstantin!, that solves the problem.

br
HP