public class Blog extends Model<Blog> { public static final Blog dao = new Blog().dao(); public User getUser() { return User.dao.findById(get("user_id")); } } public class User extends Model<User>{ public static final User dao = new User().dao(); public List<Blog> getBlogs() { return Blog.dao.find("select * from blog where user_id=?", get("id")); } }
查询List<Blog> 将会触发多次sql查询User的情况
项目:JFinal