<?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <!-- Generated 2016-4-14 14:39:20 by Hibernate Tools 3.4.0.CR1 --> <hibernate-mapping> <class name="hibernate.Students" table="STUDENTS"> <id name="sid" type="int"> <column name="SID" /> <generator class="native" /> </id> <property name="sname" type="java.lang.String"> <column name="SNAME" /> </property> <property name="gender" type="java.lang.String"> <column name="GENDER" /> </property> <property name="birthday" type="java.util.Date"> <column name="BIRTHDAY" /> </property> <component name="address" class="Address"> <property name="postcode" column="POSTCODE"></property> <property name="phone" column="PHONE"></property> <property name="address" column="ADDRESS"></property> </component> </class> </hibernate-mapping>
这个错是因为啥了,我和视频写的一模一样呀
org.hibernate.InvalidMappingException: Could not parse mapping document from resource Students.hbm.xml
我也是这是为什么我把"."换成"/"就不对,这是路径还是什么?
我也碰到了这个问题,
<component name="address" class="test.Address"> <property name="postcode" column="POSTCODE"/> <property name="phone" column="PHONE"/> <property name="address" column="ADDRESS"/> </component>
<component name="address" class="test.Address">就好了,test改成你的包名。
不知道什么原因,可能哪里设置问题,或者版本不同了。
映射文件的存放路径有没有问题?