<hibernate-mapping package="com.raymoth.pojo">
<class name="com.raymoth.pojo.Student" table="student">
<id name="name" column="NAME" type="String">
<generator class="assigned"/>
</id>
<property name="age" column="AGE" type="java.lang.String"/>
</class>
</hibernate-mapping>以上是student.hbm.xml的配置文件。
下划线的部分,MyEclipse还没有编译就报错:
Multiple annotations found at this line:
Attribute "column" must be declared for element type "property".
Attribute "name" must be declared for element type "property".
<class name="com.raymoth.pojo.Student" table="student">
<id name="name" column="NAME" type="String">
<generator class="assigned"/>
</id>
<property name="age" column="AGE" type="java.lang.String"/>
</class>
</hibernate-mapping>以上是student.hbm.xml的配置文件。
下划线的部分,MyEclipse还没有编译就报错:
Multiple annotations found at this line:
Attribute "column" must be declared for element type "property".
Attribute "name" must be declared for element type "property".
楼主【raymoth123】截止到2008-07-12 16:59:48的历史汇总数据(不包括此帖):
发帖的总数量:0 发帖的总分数:0 每贴平均分数:0
回帖的总数量:0 得分贴总数量:0 回帖的得分率:0%
结贴的总数量:0 结贴的总分数:0
无满意结贴数:0 无满意结贴分:0
未结的帖子数:0 未结的总分数:0
结贴的百分比:---------------------结分的百分比:---------------------
无满意结贴率:---------------------无满意结分率:---------------------
如何结贴请参考这里:http://topic.csdn.net/u/20080501/09/ef7ba1b3-6466-49f6-9d92-36fe6d471dd1.html
<property name="name" type="string" >
<column name="AGE" length="50" />
</property>
上面那个<id name="name" column="NAME" type="String"> 都没有报错。
WARN Please initialize the log4j system properly.
原因是把student.hbm.xml的文件头用错了,我用的头文件是从配置hibernate.cfg.xml复制的,应该用
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> 原来我用的是<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> 这是源自我的大意!!感谢大家的帮助!!但现在又有一个问题,我编译一个test.java测试java文件时候他报错:
Document root element "hibernate-mapping", must match DOCTYPE root "hibernate-configuration".
的问题是由于头文件复制的时候有错误!!
重新复制解决了!!
还是大意!!!痛改痛改!!