title: Best practices for exception in my DAO layer
body: <p>I'm working on my dao layer implementation and I'm confused about the exception handling part. I have many solution to throw  exception so  what is the best solution to handle exception in dao layer :</p>
  
  <p>This is my code : </p>
  
  <p>My DAO Interface : </p>
  
  <pre><code>@Repository
  @Transactional
  public interface GnqstRepository&lt;T,V&gt;  {
  
     public  T save(T t);
     public  void delete(V v)throws GnqstRepositoryNotFoundException;
     public  T update(T t); 
     public  T find(V v)throws GnqstRepositoryNotFoundException;
     public  List&lt;T&gt; findAll();
  
  
  }
  </code></pre>
  
  <p>And this is my this an implementation for an entity : </p>
  
  <pre><code>public class EnqueteurRepository implements GnqstRepository&lt;Enqueteur, Long&gt; {
      @PersistenceContext(name="gnst")
      private EntityManager em ;
  
      private static final Logger logger = Logger.getLogger(EnqueteurRepository.class);
  
  
      @Override
      public Enqueteur find(Long v)throws GnqstRepositoryNotFoundException {
          Enqueteur enqueteur = em.find(Enqueteur.class,v);
          if(enqueteur!= null){
              logger.info("EnqueteurRepository : l'enqueteur avec l'ID : "+v+" a été trouvé avec succès.");
              return enqueteur;
          }
          else{
              throw new GnqstRepositoryNotFoundException("L'identifiant entré ne ressemble pas à un ID enqueteur valide.");
          }
      }
  }
  </code></pre>
  
  <p>Here I create a checked exception my question is there best way than this to throw an exception to the next layer in case for example the find method do not find an entity ? </p>
  
  <p>My objectif is that the user in IHM when click in button find for search in case of no result found then a message should show in IHM in my case I throw exception with a message throught dao layer,business layer to presentation layer my question is who is the best throw an exception or return null to the presentation layer then check an return message to the user ?Thank in advance </p>