Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
apgw
Post subject: [Closed]Hibernate tutorial error (Oracle)  PostPosted: Nov 20, 2005 - 02:09 AM
Veteran Member
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?
 
 View user's profile Send private message  
Reply with quote Back to top
support-rkalla
Post subject:   PostPosted: Nov 21, 2005 - 06:28 PM
Moderator
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
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
apgw
Post subject:   PostPosted: Nov 22, 2005 - 01:55 AM
Veteran Member
Veteran Member


Joined: Nov 20, 2005
Posts: 2

Thanks for the help.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits