I have an entity called "Period" with a boolean attribute called "processing". I want to make a function for a repository that returns "true" if there is at least one record in the DB with the attribute "processing in true", however I'm not sure how to do it with Jpa, this is what I tried:
public interface PeriodoRepository extends JpaRepository<Periodo, Long>
{
@Query("SELECT CASE WHEN EXISTS ( SELECT P FROM Periodo P WHERE
P.procesando = false ) THEN CAST(0 AS BIT) ELSE CAST(1 AS BIT) END")
public boolean isPeriodoProcesando();
}