How to select what a data grid shows

Hey,

I have this application that allows users to create meetings and add participants to those meetings. I have 2 Tables named Meetings and Participants… I have a meeting browser screen with a group table and i want it to only display the meetings the current user is a participant of and the meetings that the user created.

The jpql i used achieve this was the following:

“select m from agenda$Meeting m join agenda$Participant p on m.id = p.meeting_id.id where m.createdBy = :custom$user or p.name.id = :custom$part”

the above query only works when there is at least one participant in the meeting. how do i make it so that even if there is no participant in the meeting… the meeting still shows up in the meeting browser of the person who created that specific meeting.

Regards,

Hey!

Add an associations:

  1. between Participant and User (one-to-one);
  2. between Meeting and Participant (one-to-many).

Correct JPQL query:
“select m from agenda$Meeting m left join m.participants p where m.createdBy = :session$userLogin or p.id is null or p.user.id = :session$userId"

Hey,

I tried that query and its giving me the following error

image

Regards

Hey!

@susan.helao, please post screenshot of your Meeting entity

Hey,
This is my meeting entity

image

and this is my participant enity

image

Regards

@susan.helao, не вижу что ты сделала это

The error text says this. In Meeting entity did not find a collection of Participants.

Metting_ID_ID (field name in DB) - is bad practice.
Please, rename field meeting_id to meeting.
From the point of view of the system logic, you have a reference to the entity, not its id of entity.

meeting.meeting-description!? -> meeting.description.
meeting.date(time)?? start or end & planned or actual ??? -> meeting.plannedStartDate(Time)

add field “duration” to Meeting

Sorry :grinning:, small code review.

Hey,

If i change meeting to meeting id to meeting… it would break the program because i used meeting id in other entities.

Regards

Hey,
Use refactoring in IDEA