package es.uv.garcosda.data.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import es.uv.garcosda.data.domain.Mail;


public interface MailRepository extends CrudRepository<Mail, String> {

	@Query(value="SELECT * FROM mails WHERE _from = ?1 ORDER BY _date DESC", nativeQuery = true)
	public List<Mail> findByFrom(String from);
	@Query(value="SELECT * FROM mails WHERE _to = ?1 ORDER BY _date DESC", nativeQuery = true)
	public List<Mail> findByTo(String to);
	
}
