-->
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.  [ 1 post ] 
Author Message
 Post subject: Help for the first step in tutorial for 4.1.6 Final
PostPosted: Tue Sep 11, 2012 11:50 pm 
Newbie

Joined: Tue Sep 11, 2012 11:36 pm
Posts: 2
I am very new to Hibernate. I am trying to follow the first tutorial for 4.1.6 Final. Following is the

http://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html_single/#tutorial-firstapp-setup

I setup the project using maven and use the same codes from the tutorial. When I tried to run the EventManager, I got following exceptions.

Code:
Initial SessionFactory creation failed.org.hibernate.InvalidMappingException: Could not parse mapping document from resource org/hibernate/tutorial/domain/Event.hbm.xml
Exception in thread "main" java.lang.ExceptionInInitializerError
   at org.hibernate.tutorial.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:31)
   at org.hibernate.tutorial.util.HibernateUtil.<clinit>(HibernateUtil.java:14)
   at org.hibernate.tutorial.EventManager.createAndStoreEvent(EventManager.java:35)
   at org.hibernate.tutorial.EventManager.main(EventManager.java:17)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource org/hibernate/tutorial/domain/Event.hbm.xml
   at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:3411)
   at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXmlQueue(Configuration.java:3400)
   at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3388)
   at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1341)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1733)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1784)
   at org.hibernate.tutorial.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:25)
   ... 3 more
Caused by: org.hibernate.DuplicateMappingException: Duplicate class/entity mapping org.hibernate.tutorial.domain.Event
   at org.hibernate.cfg.Configuration$MappingsImpl.addClass(Configuration.java:2576)
   at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:173)
   at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:3408)
   ... 9 more


Could anyone help me on this?


The other problem I have is that the way to create a service SessionFactory in tutorial is actually using a deprecated method.

conf.configure().buildSessionFactory()

I wonder if there is better way to create the factory.


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

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.