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