Annotation Interface ResultType


@Documented @Retention(RUNTIME) @Target(METHOD) public @interface ResultType
This annotation can be used when a @Select method is using a ResultHandler. Those methods must have void return type, so this annotation can be used to tell MyBatis what kind of object it should build for each row.

How to use:

 public interface UserMapper {
   @ResultType(User.class)
   @Select("SELECT id, name FROM users WHERE name LIKE #{name} || '%' ORDER BY id")
   void collectByStartingWithName(String name, ResultHandler<User> handler);
 }
 
Since:
3.2.0
Author:
Jeff Butler
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Returns the return type.
  • Element Details

    • value

      Class<?> value
      Returns the return type.
      Returns:
      the return type