- This topic has 2 replies, 2 voices, and was last updated 19 years ago by apgw.
-
AuthorPosts
-
apgwMemberFollowing the steps to generate the mapping to the BONUS table, I get a similar error to an earlier posting (12/12/04, “Hibernate Tutorial Question – SQL String?”). This is connecting to an Oracle db:
“The content of element type “class” must match … line 17″
and
“The serializable class Bonus does not declare a static final serialVersionUID field of type long …line 13″I am using Eclipse 3.1.1, with the MyEclipse hibernate 4.0.1
The Bonus.hbm.xml:
<?xml version=”1.0” encoding=’UTF-8′?>
<!DOCTYPE hibernate-mapping PUBLIC
“-//Hibernate/Hibernate Mapping DTD 3.0//EN”
“http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd” ><!– DO NOT EDIT: This is a generated file that is synchronized –>
<!– by MyEclipse Hibernate tool integration. –>
<!– Created Sat Nov 19 17:29:22 PST 2005 –>
<hibernate-mapping package=”com.genuitec.hibernate”><class name=”Bonus” table=”BONUS”>
<property name=”ename” column=”ENAME” type=”string” />
<property name=”job” column=”JOB” type=”string” />
<property name=”sal” column=”SAL” type=”long” />
<property name=”comm” column=”COMM” type=”long” />
</class></hibernate-mapping>
How and where would I fix this?
Riyad KallaMember“The content of element type “class” must match … line 17″
The problem is that the table you mapped, BONUS, does not have a primary key defined. So your <class> element is generated without an ID which is required for Hibernate to persist instances of that class.
“The serializable class Bonus does not declare a static final serialVersionUID field of type long …line 13”
This is a Java compiler warning you can change under your compiler settings from Java preferences.
apgwMemberThanks for the help.
-
AuthorPosts