Interface MessagesRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Message,,String> org.springframework.data.repository.Repository<Message,String>
@Repository
public interface MessagesRepository
extends org.springframework.data.repository.CrudRepository<Message,String>
Spring Data repository used to access the messages in BBDD. See
Message.-
Method Summary
Modifier and TypeMethodDescriptionfindAllByEventAndCompany(Event event, Company company) Search for all messages configured for the given event and the given company.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findAll, findAllById, findById, save, saveAll
-
Method Details
-
findAllByEventAndCompany
@Query(nativeQuery=true, value="SELECT m.id, m.name, m.description, m.company_id, m.message_type_id, m.sender_id FROM Message m INNER JOIN event_message_rel evr on evr.message_id = m.id INNER JOIN event e on e.id = event_id WHERE e.id = :event and m.company_id = :company") List<Message> findAllByEventAndCompany(@Param("event") Event event, @Param("company") Company company) Search for all messages configured for the given event and the given company.- Parameters:
event- the event which associated messages are to be retrieved.company- the company the messages must be designed for.- Returns:
- all messages configured for the given event and the given company.
-