-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: The content of element type "class"(SOLVED)
PostPosted: Sat Oct 01, 2011 12:09 pm 
Newbie

Joined: Sat Oct 01, 2011 11:28 am
Posts: 6
I am new at Hibernate I have a problem with the mapping file:
this is the hibernate configuration
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property
name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://http:localhost/django</property>
<property name="connection.username">root</property>
<property name="connection.password">vilu7240</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">2</property>
<!-- SQL dialect -->
<property
name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property
name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">false</property>
<mapping resource="entities/Categoria.hbm.xml"/><mapping />
   <!--  mapping resource="/entities/Autore.hbm.xml"/><mapping /-->
   <!--  mapping resource="src/django/entities/Postit.hbm.xml"/><mapping /-->
</session-factory>
</hibernate-configuration>

this is my mapping file:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">


<hibernate-mapping>
   <class  name="entities.Catgoria" table="categorie" lazy="false">
   
   <meta attribute="class-description">This class contains category details.</meta>

<id name="categoriaId" type="long" column="id">

         <generator class="auto" />

</id>
      
   
      <property name="categoria" type="string" column="categoria"/>
   
      

      
   <key>
      <column name="categoriaId" />   
   </key>
   

   </class>
</hibernate-mapping>

thi is the error that Eclipse reports to me

Quote:
The content of element type "class" must match
"(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-
id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|
component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-
array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-
update?,sql-delete?,filter*,fetch-profile*,resultset*,(query|sql-query)*)".

I should not have so many difficulties for this file, couse is an easy configuration, can someone tell what is my mistake? thanks a lot in advance


Last edited by arpho on Mon Oct 03, 2011 1:34 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: The content of element type "class"
PostPosted: Sun Oct 02, 2011 3:40 pm 
Newbie

Joined: Sun Sep 25, 2011 4:05 pm
Posts: 12
From the quote at the bottom of your post, it does not include the element "key" in that list. It looks like you're trying to declare the primary key column with that element, but that was already accomplished with the "id" element. I'm pretty sure you should just delete the "key" element and its contents.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.