测试报错。是按照老师的演示来的
@Test
public void testSaveStudents(){
//生成学生对象
Students s1 = new Students();//注意顺序
s1.setSname("试试");
s1.setGender("女");
s1.setBirthday(new Date());
Address address = new Address("6130","63302","大第县");
s1.setAddress(address);
session.save(s1);
}
因为最初运行时显示:could not parse mapping document from resource Students.hbm.xml.然后下面显示是由于:class Address not found while looking for property:postcode. 在网上找了解决方法,就在后面加了类型。但是依然会报错:
Unable to instantiate default tuplize org.hibernate.tuple.entity.PojoEntityTuplizer].
<component name="address" class="Address" >
<property name="postcode" column="POSTCODE" type="java.lang.String"/>
<property name="phone" column="PHONE" type="java.lang.String"/>
<property name="address" column="ADDRESS" type="java.lang.String"/>
</component>