@Repository
public class AuthorAdminDaoImpl implements IAuthorAdminDao {
@Resource
private BaseDAO basedao;
public boolean loginAuthorAdmin(AuthorAdmin aa) {
try {
String queryString = " from AuthorAdmin a where a.authorName= ? and a.authorPwd= ? ";
basedao=new BaseDAO();
if (basedao.getTemplate() == null) {
System.out.println("没有获得HibernateTemplate?");
}
List find = (List) basedao.getTemplate().find(
queryString, aa.getAuthorUsername(), aa.getAuthorPwd());
if (find != null && find.size() > 0) {
return true;
} else {
return false;
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException();
}
}
}
public class BaseDAO extends HibernateDaoSupport{
public HibernateTemplate getTemplate(){
return getHibernateTemplate();
}
}
HibernateTemplate为空不知道为什么?用的是Spring注入
org.hibernate.dialect.MySQLDialect
true
true
com/lcy/po/DocumentInfo.hbm.xml
com/lcy/po/ColumnEditorAdmin.hbm.xml
com/lcy/po/ExpertAdmin.hbm.xml
com/lcy/po/AttachInfo.hbm.xml
com/lcy/po/DocumentStateInfo.hbm.xml
com/lcy/po/ColumnInfo.hbm.xml
com/lcy/po/MessageInfo.hbm.xml
com/lcy/po/MagazineEditorAdmin.hbm.xml
com/lcy/po/BoardInfo.hbm.xml
com/lcy/po/ExpertAssess.hbm.xml
com/lcy/po/AuthorAdmin.hbm.xml
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
本来 Spring 已经帮你把 basedao 注入了你XML里配置好的对象, 你后面又用
创建了个新对象, 把那个 Spring 给注入的 bean 替换掉了...