Skip to content

Instantly share code, notes, and snippets.

@eatgrass
Last active December 23, 2016 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eatgrass/6b663d194ea623b960190df1924ed194 to your computer and use it in GitHub Desktop.
Save eatgrass/6b663d194ea623b960190df1924ed194 to your computer and use it in GitHub Desktop.
Mybatis OneToMany Example
public interface ClassADAO {
@Select("SELECT id, name, description FROM TableA WHERE id = #{id}")
@Results({@Result(property = "id", column = "id"),
@Result(property = "list", javaType = List.class, column = "id",
many = @Many(select = "ClassBDao.getClassBForClassA"))})
ClassA getClassAById(@Param("id") long id);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment