传入HibernateCallback借口的对象一定要序列化
public Loginer getLoginer(final Loginer loginer) throws Exception {
return getHibernateTemplate().execute(
new HibernateCallback<Loginer>(){
public Loginer doInHibernate(final Session session)
throws HibernateException, SQLException {
String sql = "from Loginer as lg where lg.loginerId = '"+loginer.getLoginerId()+"' and lg.status = 1 ";
return (Loginer) session.createQuery(sql).uniqueResult();
}
}
);
}
public Loginer getLoginer(final Loginer loginer) throws Exception {
return getHibernateTemplate().execute(
new HibernateCallback<Loginer>(){
public Loginer doInHibernate(final Session session)
throws HibernateException, SQLException {
String sql = "from Loginer as lg where lg.loginerId = '"+loginer.getLoginerId()+"' and lg.status = 1 ";
return (Loginer) session.createQuery(sql).uniqueResult();
}
}
);
}