用的是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 class="native"/></id>
<property name="PROVINCE_ID"/>
<property name="CONFIG_NAME"></property>
<property name="VALS"></property>
<property name="UNITS"></property>
</class>
</hibernate-mapping>
这个是调试时list的值:
求大神指教到底是哪里有问题。
hibernate J2EE
------解决方案--------------------
解决了我来接分帮楼主结贴!
------解决方案--------------------
分享下答案啊