-->
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.  [ 3 posts ] 
Author Message
 Post subject: An AnnotationConfiguration instance is required to use (...)
PostPosted: Mon Feb 04, 2008 12:58 pm 
Newbie

Joined: Mon Feb 04, 2008 12:49 pm
Posts: 3
Location: Brazil
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.2.2

Mapping documents:
Code:
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.sssistemas.opera.bean">
   <class name="Atividade" table="Atividade">
      <!-- Coluna identificadora  -->
      <id name="id" column="id" type="integer">
         <generator class="assigned" />
      </id>

      <property name="descricao" column="descricao" type="string" length="60" />

   </class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
Does not apply here. The error is before openSession().

Full stack trace of any exception that occurs:
Code:
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.ExceptionInInitializerError
   at HibernateUtil.<clinit>(HibernateUtil.java:12)
   at Teste.<init>(Teste.java:4)
   at Teste.main(Teste.java:34)
Caused by: org.hibernate.MappingException: An AnnotationConfiguration instance is required to use <mapping class="Atividade"/>
   at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1600)
   at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1555)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1534)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1508)
   at org.hibernate.cfg.Configuration.configure(Configuration.java:1428)
   at HibernateUtil.<clinit>(HibernateUtil.java:9)
   ... 2 more


Name and version of the database you are using:
PostgreSQL 8.2.6

The generated SQL (show_sql=true):
Does not apply. Cannot execute SQL since error is in configure() method.

Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html

_________________
T.J. Adami


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 04, 2008 1:39 pm 
Regular
Regular

Joined: Mon Aug 20, 2007 6:47 am
Posts: 74
Location: UK
Can you post the code for HibernateUtil.java and Atividade.java?

Have you got any hibernate/JPA annotations in Atividade.java?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 04, 2008 2:50 pm 
Newbie

Joined: Mon Feb 04, 2008 12:49 pm
Posts: 3
Location: Brazil
Ohh... I'm so ashamed by that.

I didn't notice the hibernate.cfg.xml was a wrong parameter.

The old line was:
Code:
<mapping class="Atividade" file="Atividade.hbm.xml" />


And works fine when replaced by:
Code:
<mapping class="Atividade" resource="Atividade.hbm.xml" />


It's only a word changed: "file" by "resource".

_________________
T.J. Adami


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.