Hi,
1. I am working on a project, where it make use of LDAP and mysql for storing user records.In my case, when a user registers,some details go and sit into mysql and some into LDAP. 2. In this scenario,the save happens first in mysql then into LDAP, but in case there is any exception/error occurred during saving to LDAP, the entries made into mysql should be rolled back. 3. But in may case I am trying to do that, and it thorws exception saying "org.hibernate.TransactionException: Transaction not successfully started" but it seems its trying to save the record into db.
here is the piece of code.
************************************************************************
public void saveorUpdate( Object instance ) { boolean isFlag=false; Session session = null; Clasuser clasUser =null; Transaction txn = null; try{ session = sessionFactory.getCurrentSession(); session.saveOrUpdate( instance ); clasUser = (Clasuser)instance; if(clasUser.getAction().equalsIgnoreCase("Add")) isFlag = insertUserLDAP(clasUser); else isFlag = updateLDAP(clasUser); //session.flush(); }catch(NamingException runExcp){ session.getTransaction().rollback(); } }
************************************************************************
Guys, need your expert help to solve my issue.
Thanks, Abhijit
_________________ Thanks, Abhijit
|