1
I’m performing a system in Java using Springboot and JPA, being event management and have two entities: Inscricao
and HorarioAtividade
.
They have a relationship Many To Many, with my class Inscricao
having a list of HorarioAtividades
with the activities of each enrollment and the Class HorarioAtividade
possessing a list of Entries with the entries of that activity.
The class Inscricao
also has an attribute situacao
who’s kind enum
, ex.
SituacaoInscricao.RESERVADA
SituacaoInscricao.CONFIRMADA
SituacaoInscricao.AG_PAGAMENTO
When I make a findAll
in the repository of HorarioAtividade
, it brings the schedules Activities with the list of registrations all straight automatically through their relationship.
The problem I can’t solve is:
I need to get all the HorarioAtividade
from my base, only it is bringing only the registrations that are confirmed and awaiting payment.
I’ve tried with join fetch
, but he ends up mixing everything and the query is not correct.
I searched about the Criteria api, but I didn’t understand how to solve my problem with her.
It would be interesting to put the code in the question
– Weslley Barbosa