Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

how to make hbm2ddl.auto work without a hbm.xml file

 
Ranch Hand
Posts: 820
IntelliJ IDE VI Editor Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I'm used to doing hibernate with lots of mapping files.
Now, I've been working a web application using hibernate with annotations that has hbm2ddl.auto set to update. It works without any kind of *.hbm.xml mapping file because (I thought) all the entities are done with annotations.
it uses a persistence.xml ( and a data source defined in context.xml )



So, in a simple stand-alone hibernate test app with annotations, I would expect to be able to do the same thing. However, it requires a *.hbm.xml file
without one, the error is:
SEVERE: Error parsing XML: hibernate.cfg.xml(15) The content of element type "session-factory" must match "(property*,mapping*,(class-cache|collection-cache)*,event*,listener*)". )

hibernate.cfg.xml is



So I'm thinking that in all the Hibernate / Seam / EJB / JPA libraries included with the Web application, there is something that allows the hbm2ddl.auto to function without the mapping file. Does anyone know which additional libraries I would need and / or how to achieve hbm2ddl.auto without mapping files?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm, I thought the "*" meant zero or more.
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic