• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate 5.0.0 - Mapping in hibernate.cfg.xml ignored?

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 in "hibernate.cfg.xml" seem to be totally ignored...

Doing a query leads to
Doing a save or update operation leads to
Everything works fine, when I add the resources programatically in the configuration with 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


Excerpt from SessionFactory


(sorry for this cross-posting from https://forum.hibernate.org/viewtopic.php?f=1&t=1041405 - this forum seems to be flooded with spam right now )
 
Author
Posts: 141
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you try this to create your SessionFactory:

 
A. Koch
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great, this seems to work fine . In addition to your proposed code I only had to change <session-factory name=""> to <session-factory> in my "hibernate.cfg.xml", as I got a JNDI-naming Exception. Thank you very much!!!

Is there any note in the official documentation, that using "configuration.buildSessionFactory(serviceRegistry);" does not work as expected? I couldn´t find any...
reply
    Bookmark Topic Watch Topic
  • New Topic