用Hibernate3.3.2 this.hibernateTemplate.find查询list返回的都是空元素,求大神
用的是struts2+spring2+hibernate在框架
1、这个是Dao类:
public class ProvinceDaoImpl extends HibernateDaoSupport implements ProvinceDao{
@SuppressWarnings("null")
private HibernateTemplate hibernateTemplate;
@SuppressWarnings("unchecked")
public List QueryProvince() {
// TODO Auto-generated method stub
List<T_Province> list = null;
Configuration config = new Configuration();
config.configure();
SessionFactory sessionFactory = config.buildSessionFactory();
this.hibernateTemplate = new HibernateTemplate(sessionFactory);
try{
list = this.hibernateTemplate.find("from com.province.entity.T_Province");
}catch(Exception e){
e.printStackTrace();
}
return list;
}
}
2、以下是实体映射T_Province.hbm.xml:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.province.entity">
<class name="T_Province" table="T_PROVINCE">
<id name="ID" column="ID">
<generator alt="用Hibernate3.3.2 this.hibernateTemplate.find查询list回来的都是空元素,求大神" />
求大神指教到底是哪里有问题。
hibernate J2EE
[解决办法]
解决了我来接分帮楼主结贴!
[解决办法]
分享下答案啊