I am using entity bean & session bean in my project my session bean calls the entity bean .My problem is that when i pass a string parameter in findByPrimaryKey(String) and if it does not exist then javax.ejb.ObjectNotFoundException is thrown now i want to catch this exception ...i tried alot but am not able to catch it..... is there any means to catch the exception. Please help as early as possible.... thanx in advance ... regards , Apurva.
umar hathab
Ranch Hand
Joined: Aug 20, 2001
Posts: 52
posted
0
Hi, I hope u are forming the query and call executeQuery() inside findBy() method.When u get the ResultSet, call rs.next() method .If that method returns false,there is no record in database and throw ObjectNotFoundException with some message.If there is some record get it and catch SQLException.Inside catch throw EJBException.Hope this may help u. A.UMAR HATHAB
Sun Certified Java Programmer for Java 2.0 (93%) <p>----Winners always make the learning a habit