I have a Stateful Session Bean that i am using to persist data
@Local
public interface GeneralDao {
public void saveNewUser(User user, UserContact userContact)throws CunnectedDBException; }
and the implementation is
public void saveNewUser(User user, UserContact userContact)throws CunnectedDBException { EntityManager em = (EntityManager) Component.getInstance("entityManager"); em.persist(user); log.info("Next User Id {0}", user.getId()); int g=10/0; userContact.setUser(user); em.persist(userContact); }
when it gets to the user it saves it in the database , and when it gets to the division , it throws an exception but the data it saved still remains in the Database. Please how can i resolve this