facebook

[Closed]Hibernate tutorial error (Oracle)

  1. MyEclipse Archived
  2.  > 
  3. Documentation
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #241813 Reply

    apgw
    Member

    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&#8221; >

    <!– 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?

    #241847 Reply

    Riyad Kalla
    Member

    “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.

    #241886 Reply

    apgw
    Member

    Thanks for the help.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: [Closed]Hibernate tutorial error (Oracle)

You must be logged in to post in the forum log in