I would like to ask for some help. I am a beginner in JMIX. I am experimenting with the latest JMIX version.
Data model: User → Participant ← Event
To load data for a table (DataGrid), I should use the following SQL command:
SELECT u.username, p.sign_up_date_time
FROM User u
LEFT OUTER JOIN Participant p ON p.user_id = u.id AND p.event_id = :anEvent
LEFT OUTER JOIN Event e ON p.event_id = e.id AND e.id = :anEvent
ORDER BY u.username ASC;
Unfortunately, I don’t know how to do this.
1.option) Rewrite SQL to JPQL, but I don’t know how. The SQL command seems too complex for translate to JPQL.
2.option) Load data with a native SQL command, but I couldn’t find any guide in the documentation, no example on how to do it.
3.option) Some other solution, other idea? …
Background information:
The goal is to list all users (User table) in a DataGrid table. Enter a specified event (from Event table) as an input parameter (anEvent), and for those users who have already signed up (have a Participant record), display the sign-up time, and for those who haven’t, display NULL.
Thank you in advance for your help.