日期:2014-05-16 浏览次数:20432 次
@Override public AppsAccount findByUserAndApp(Users user, Apps app) { final DetachedCriteria query = DetachedCriteria .forClass(AppsAccount.class); Criteria criteria = query.getExecutableCriteria(getSession()); criteria.add(Restrictions.eq("users", user)); criteria.add(Restrictions.eq("apps", app)); @SuppressWarnings("unchecked") List<AppsAccount> list = criteria.list(); if (list != null && !list.isEmpty()) { return list.get(0); } return null; }
public class AppsAccount implements java.io.Serializable { // Fields /** * */ private static final long serialVersionUID = 2255050572597512586L; private String id; private Users users; private Apps apps; private String account; .....