We are facing performance issue when we are adding participants related appointment and saving them. The reason I found is because when the mapped child 'Appointment' method 'getParticipant()' is called when the mapped parent 'Participant' entity having 'getAppointment()' is invoked, creating multiple joins query, which inturn fetches unwanted recordset.
Now I do not want my parent 'Participant' method 'getAppointment()' to get called, which resolves the issue, which I could test by commenting it out.
Is there a way I give any annotation which saves me commenting method, which is a bad practice I know. There are other similar examples in the code which cannot be commented, since they are used in code. Below are the Two Entity classes having the mapped methods:
Participants { @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE}, mappedBy = "participants", targetEntity = com.skeds.core.domain.Appointment.class, fetch = FetchType.LAZY) @Audited(withModifiedFlag=true) public Set<Appointment> getAppointments() { return appointments; } .. .. }
Appointments { @ManyToMany(targetEntity = com.skeds.core.domain.Participant.class, cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH, CascadeType.REMOVE }, fetch = FetchType.LAZY) @Filter(name = "ACTIVE", condition = "ACTIVE=1") @JoinTable(name = "APPOINTMENTS_HAVE_PARTICIPANTS", joinColumns = @JoinColumn(name = "APPOINTMENT_ID"), inverseJoinColumns = @JoinColumn(name = "PARTICIPANT_ID")) @Audited(withModifiedFlag=true) public Set<Participant> getParticipants() { return participants; } .. .. }
Can someone help here. Thanks in advance.
|