one ->many
@SelectProvider(type=Vote1SqlProvider.class, method="selectByExample")
@ConstructorArgs({
@Arg(column="VID", javaType=Integer.class, jdbcType=JdbcType.INTEGER, id=true),
@Arg(column="Title", javaType=String.class, jdbcType=JdbcType.VARCHAR),
@Arg(column="Describes", javaType=String.class, jdbcType=JdbcType.VARCHAR),
@Arg(column="Selection", javaType=String.class, jdbcType=JdbcType.VARCHAR),
@Arg(column="Type", javaType=Integer.class, jdbcType=JdbcType.INTEGER),
@Arg(column="Limits", javaType=Integer.class, jdbcType=JdbcType.INTEGER),
@Arg(column="Pass", javaType=String.class, jdbcType=JdbcType.VARCHAR)
})
@Results( {@Result(property="details",column="VID",
many=@Many(select="pers.adlered.voter.service.VoteDetailMapper.selectByVid")),
@Result(property="tokens",column="VID",
many=@Many(select="pers.adlered.voter.service.VoteTokenMapper.selectByVid"))
})
List<Vote1> selectDetailAndTokenByExample(Vote1Example example);
mybatis config xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<typeAliases>
<package name="pers.adlered.voter.domain"/>
</typeAliases>
<environments default="development">
<environment id="development">
<transactionManager type="JDBC" />
<dataSource type="POOLED">
<property name="driver" value="${spring.datasource.driver-class-name}"/>
<property name="url" value="${spring.datasource.url}"/>
<property name="username" value="${spring.datasource.username}"/>
<property name="password" value="${spring.datasource.password}"/>
</dataSource>
</environment>
</environments>
<mappers>
<package name="pers.adlered.voter.service"/>
</mappers>
</configuration>