I've switched from using Spring Data JPA for regular DAO objects with Entity Manager and found out, that instead of returning null the .getSingleResult() throws NoResultException. Is there some way of adding an aspect that would surround all the DAO function with Try {} Catch{} and return null instead of NoResultExceptions?
Or is there some other way of forcing my DAO objects to return null instead of exceptions without manually surrounding all of them?
If I were you, I'd implement another Entity Manager (which inherits from the default one), and I'd override the getSingleResult() with a try/catch in order to return null.
Then, I'll inject my new Entity Manager to my Spring context.