Im working on spring mvc app. My problem is when I call delete method in dao by controller class, exception is not handle in dao. but if I use try catch around calling method in controller it'll catch the error.
controller class method:
customerDao.delete(id);
Rapository class:
public void delete(long id)
{
try{
em.remove(em.find(id));
}
catch(Exception e)
{
//not come to here
}
}
If I use try catch around "customerDao.delete(id);" handle error. Why I cant handle exception in dao class. Note : Exception thrown is child record found unexpectedrollbackexception
Aucun commentaire:
Enregistrer un commentaire