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.xmlCode:
<?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 SessionFactoryCode:
Configuration configuration = new Configuration();
configuration.configure("hibernate.cfg.xml");
serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();
sessionFactory = configuration.buildSessionFactory(serviceRegistry);