-->
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: MappingNotFoundException
PostPosted: Wed Oct 24, 2007 6:41 am 
Newbie

Joined: Thu Oct 04, 2007 5:00 am
Posts: 13
Hibernate version:3.2 GA

Mapping documents:
hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">org.apache.derby.jdbc.ClientDriver</property>
<property name="connection.username">app</property>
<property name="connection.password">app</property>
<property name="connection.url">jdbc:derby://localhost:1527/app</property>

<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.DerbyDialect</property>

<!-- Debug logging of SQL statements -->
<property name="show_sql">true</property>

<mapping resource="/ormapping/Name.hbm.xml"/>
</session-factory>
</hibernate-configuration>



Name.hbm.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="pojo.Name" table="NAME">
<id name="nameid" column="NAMEID">
<generator class="assigned"/>
</id>
<property name="firstname" column="FIRSTNAME"/>
<property name="lastname" column="LASTNAME"/>
</class>
</hibernate-mapping>






code
Configuration cfg = new Configuration().configure();
factory = cfg.buildSessionFactory();

Full stack trace of any exception that occurs:
Oct 24, 2007 4:02:45 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.2.4.sp1
Oct 24, 2007 4:02:45 PM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Oct 24, 2007 4:02:45 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
Oct 24, 2007 4:02:45 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Oct 24, 2007 4:02:46 PM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Oct 24, 2007 4:02:46 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Oct 24, 2007 4:02:46 PM org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : /ormapping/Name.hbm.xml
Exception in thread "AWT-EventQueue-0" org.hibernate.MappingNotFoundException: resource: /ormapping/Name.hbm.xml not found
at org.hibernate.cfg.Configuration.addResource(Configuration.java:563)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1587)
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 org.hibernate.cfg.Configuration.configure(Configuration.java:1414)
at hibernatecorejavaapplication.NameEntryForm.<init>(NameEntryForm.java:23)
at hibernatecorejavaapplication.NameEntryForm$1.run(NameEntryForm.java:106)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 24, 2007 2:39 pm 
Newbie

Joined: Mon Apr 30, 2007 12:27 pm
Posts: 18
resource: /ormapping/Name.hbm.xml not found

To me, it seems that the resource name.hbm.xml defined in hibernate.cfg.xml canĀ“t be found, because it isnt in the place where hibernate is expecting it to be.

you can try <mapping file="ormapping/Name.hbm.xml" />, if ormapping is the place where you store your mapping fies.

Or if you wanna stay with <mapping resource="/ormapping/Name.hbm.xml"/> check the appropiate configuration.

Hope it helps, cheers.


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.