Announcement Announcement Module
Collapse
No announcement yet.
Handling Transaction Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Handling Transaction

    now i want to handle transaction, so i write service class like this:
    public String insertDataDictionary(String xmlParam) {
    try {
    ......
    dataDictionaryDao.insertDataDictionary(model);
    dataDictionaryDao.deleteDataDictionary(111);
    } catch (Exception e) {
    return ErrorMessage.errorXml(e);
    }
    return SuccessMessage.successXml();
    }

    when i didn't use try... catch , roll back is perfect..

    but when i used tyr ..catch , rollback didn't work..
    how can i make service class..???

    ** this is DAO class ***
    public void deleteDataDictionary(int wordno){
    int result = this.executeUpdate("DataDictionary.deleteDataDicti onary", new Integer(
    wordno));
    if (result == 0)
    new RuntimeException("There is no data !! ");
    }

  • #2
    when i didn't use try... catch , roll back is perfect..
    You need to throw a RuntimeException or a checked exception with a rollback rule (which is why it worked without a try...catch). Otherwise you have to do progrommatic transaction rollback.

    Comment

    Working...
    X