-->
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: element in configuration specifies no attributes(SOLVED)
PostPosted: Sun Oct 02, 2011 10:32 am 
Newbie

Joined: Sat Oct 01, 2011 11:28 am
Posts: 6
Hi I am new in Hibernate and am stuck with this error from eclipse:

Code:
Initial SessionFactory creation failed.org.hibernate.MappingException: <mapping> element in configuration specifies no attributes
Exception in thread "main" java.lang.ExceptionInInitializerError
   at util.HibernateUtil.<clinit>(HibernateUtil.java:15)
   at django.Demo.listaTutteCategorie(Demo.java:36)
   at django.Demo.main(Demo.java:110)
Caused by: org.hibernate.MappingException: <mapping> element in configuration specifies no attributes
   at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1485)
   at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1433)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1414)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1390)
   at org.hibernate.cfg.Configuration.configure(Configuration.java:1310)
   at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
   at util.HibernateUtil.<clinit>(HibernateUtil.java:11)
   ... 2 more


I do not understand what is wrong with my mapping files
my hibernate.cfg.xml
is here:
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 my entity 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 entity-name="CategoriaMap" name="entities.Categoria" table="categorie">
  <id column="id" name="id">
   <generator class="assigned"/>
  </id>
  <property column="categoria" name="categoria" type="string"/>
</class>
</hibernate-mapping>


it should be very easy and linear, can someone give some advices, any help apreciated, thanks in advance

thi


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

Top
 Profile  
 
 Post subject: Re: <mapping> element in configuration specifies no attributes
PostPosted: Sun Oct 02, 2011 1:10 pm 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
On 5th line from the end in hibernate.cfg.xml you have an empty <mapping /> element.


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.