0
public int createCountry(String countryCode) {
    // TODO Auto-generated method stub
    SqlSession session = null;
    boolean commit = false;

    int result = 0;

    //System.out.println("바보 :" + countryCode);
    try {
        session = dbutil.getSqlSession();
        result = session.update("board.updateIsCreate", countryCode);
    } finally {
        dbutil.closeSqlSession(session, commit);
    }
    System.out.println("count" + result);

    return result;
}

Here's my DapIml.java

<update id="updateIsCreate" parameterType="String">
    UPDATE country
    SET isCreated = '1'
</update>

and, This is my mapper.xml.

I already checked update's return value is correct, but it has no effect in my database. isCreated value is not changed to '1'. Any suggestion on how to achieve this? I will appreciate for your help.

1
  • show your closeSqlSession method from dbUtil Commented Jan 2, 2017 at 9:16

1 Answer 1

0

Sorry, I didn't write commit code...

I modified my daoImplement code like this :

public int createCountry(CountryVo countryVo) {
    // TODO Auto-generated method stub
    SqlSession session = null;
    boolean commit = false;

    int result = 0;

    //System.out.println("바보 :" + countryCode);
    try {
        session = dbutil.getSqlSession();
        result = session.update("board.updateIsCreate", countryVo);
        commit = result > 0 ? true : false;
    } finally {
        dbutil.closeSqlSession(session, commit);
    }
    System.out.println("count" + result);

    return result;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.