... 我晕,貌似我一直理解错了...
Sql sql = Sqls.create("select o.*, u.* from t_oauth_user o left join t_user u on o.u_id = u.id limit 1");
sql.setCallback(Sqls.callback.records());
dao.execute(sql);
for (Record re : sql.getList(Record.class)) {
System.out.println(re);
System.out.println(re.toEntity(dao.getEntity(User.class)));
System.out.println(re.toEntity(dao.getEntity(OAuthUser.class)));
}
输出
{
"pvd" :"github",
"vid" :"10126041",
"u_id" :135,
"ct" :"2015-10-23 17:17:56",
"ut" :"2015-10-23 17:17:56",
"a_url" :"https://avatars.githubusercontent.com/u/10126041?v=3",
"id" :135,
"name" :"dangfusheng",
"passwd" :"f38b767b60655f17ff0a23d4779580a8440e09826a6cc745fcbbd9d844f7c3f5",
"salt" :"80c3980d70e447529c561d827930eee8",
"locked" :false
}
/*net.wendal.nutzbook.bean.User@141e4061*/{"id":135,"name":"dangfusheng","password":"XYZ","salt":"ABC","locked":false,"createTime":"2015-10-23 17:17:56","updateTime":"2015-10-23 17:17:56"}
/*net.wendal.nutzbook.bean.OAuthUser@5d990e*/{"providerId":"github","validatedId":"10126041","userId":135,"avatar_url":"https://avatars.githubusercontent.com/u/10126041?v=3","createTime":"2015-10-23 17:17:56","updateTime":"2015-10-23 17:17:56"}