-->
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: Hibernate 5.0.0 - Mapping in hibernate.cfg.xml ignored?
PostPosted: Mon Aug 31, 2015 8:17 am 
Newbie

Joined: Mon Aug 31, 2015 3:15 am
Posts: 3
Hi everybody,

I am quite new to hibernate and was using version 4.3 until now. I upgraded to 5.0.0, as I wanted to take advantage of the Java 8 features.

I have no annotations in my code and use the "hibernate.cfg.xml"-file with ".hbm.xml"-files for each persisted class. Until now, everything worked fine, but since the upgrade, my mappings seem to be totally ignored...

Doing a query leads to
Code:
WARN: HHH000183: no persistent classes found for query class: FROM adresse.Absenderdaten

Doing a save or update operation leads to
Code:
org.hibernate.MappingException: Unknown entity: adresse.Absenderdaten

Everything works fine, when I add the resources programatically in the configuration with
Code:
Configuration configuration = new Configuration().addClass(adresse.Abenderdaten);
Unfortunately, this process takes more then a second for each persisted class, which wasn´t the case earlier with the config-file...

Can anybody tell me, why the mapping in the "hibernate.cfg.xml"-file doesn´t seem to work anymore? It is definitely read, as other parameters are recognized.

Thank you for any advice
Andy

Excerpt from hibernate.cfg.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                                         "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="">
  <property name="hibernate.connection.driver_class">org.apache.derby.jdbc.ClientDriver</property>
  <property name="hibernate.connection.url">jdbc:derby://localhost/database;create=false</property>
  <property name="hibernate.dialect">org.hibernate.dialect.DerbyTenSevenDialect</property>
  <property name="hibernate.current_session_context_class">thread</property>
  <property name="hibernate.hbm2ddl.auto">update</property>
  <property name="hibernate.show_sql">true</property>

  <mapping resource="adresse/Absenderdaten.hbm.xml"/>
  [more mappings]

</session-factory>
</hibernate-configuration>


Excerpt from SessionFactory
Code:
Configuration configuration = new Configuration();
configuration.configure("hibernate.cfg.xml");
serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();
sessionFactory = configuration.buildSessionFactory(serviceRegistry);


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