https://www.gravatar.com/avatar/f801d21a13974fa896208ef14826624f?s=240&d=mp

Divazone's Space

程式、旅遊和生活

Hibernate三種查詢資料的方式

1. HQL(Hibernate Query Language) 1 2 3 4 5 6 7 @Override public SysUser findUserByLoginName(String pLoginName) { String hql = "from SysUser as u where u.loginName = ?"; List<SysUser> users = getHibernateTemplate().find(hql, pLoginName); return users.isEmpty() ? null : users.get(0); } 2. SQL(Struc