日期:2014-05-20 浏览次数:20634 次
public static void addParent() throws InterruptedException { // 写死 Date insertTime = new Date(); Parent parent = new Parent(); parent.fullName = "新增家长"; parent.fullNamePinyin = "xin zeng jia zhang"; parent.save();//往数据库里面存入一条数据 List<Long> idFromDB = methodForDocs.getParentList(insertTime);//紧接着从数据库里面取出该条数据(更具createTime字段) System.out.println("idFromDBSize:" + idFromDB.size()); for (int i = 0; i < idFromDB.size(); i++) { System.out.println("***idFromDB:" + idFromDB.get(i)); } renderJSON(new Result("测试通过!")); }
(该方法是没有问题的) public static List<Long> getParentList(Date insertTime) { String hql = "select id from Member where createTime>?"; System.out.println("insertTime:" + insertTime.toString()); List<Long> ids = Member.find(hql, insertTime).fetch(); return ids; }