user
user

Reputation: 914

How to determine if insertions have been completed in ibatis?

@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

Upvotes: 0

Views: 34

Answers (1)

LppEdd
LppEdd

Reputation: 21134

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>

Upvotes: 1

Related Questions