How to determine if insertions have been completed in ibatis?

30 Views Asked by At
@Insert("insert into TABLE(c1, c2, c3) " +
        "values ( #{col1}, #{col2}, #{col3})")
Boolean save(Integer x, Integer y);

The returning Boolean would be True or False, determining if everything has been inserted properly

1

There are 1 best solutions below

0
LppEdd On BEST ANSWER

Anyway, you cannot do that. You need to use an int (or Integer) and compare it to 0.
If result == 0, then no rows have been inserted.

@Insert("insert into TABLE(c1, c2, c3) values (#{col1}, #{col2}, #{col3})")
int save(final Integer x, final Integer y);

Using MyBatis, you could have defined a custom ResultHandler<T>