Answers for "save single sql query result boolean spring boot"

SQL
0

save single sql query result boolean spring boot

@Repository
public interface CompanyRepository extends JpaRepository<Company, Integer> {
    @Query("SELECT CASE WHEN COUNT(c) > 0 THEN true ELSE false END FROM Company c WHERE c.name = :companyName")
    boolean existsByName(@Param("companyName") String companyName);
}
Posted by: Guest on January-11-2021

Code answers related to "save single sql query result boolean spring boot"

Code answers related to "SQL"

Browse Popular Code Answers by Language