 |
|
 |
 |
|
 |
 |
| Author |
Message |
|
|
Post subject: [Closed]Hibernate tutorial error (Oracle)
Posted: Nov 20, 2005 - 02:09 AM
|
|
Veteran Member


Joined: Nov 20, 2005
Posts: 2
|
|
Following 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? |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Nov 21, 2005 - 06:28 PM
|
|
Moderator


Joined: Jan 06, 2004
Posts: 23462
|
|
| Quote: |
"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.
| Quote: |
"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. |
_________________ Riyad
MyEclipse Support
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Nov 22, 2005 - 01:55 AM
|
|
Veteran Member


Joined: Nov 20, 2005
Posts: 2
|
|
|
|
|
 |
|
|
| |
|
|
 |
|
 |
|
|
|
 |