• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Generate hibernate.cfg.xml from Annotations  RSS feed

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to generate the mapping elements of hibernate.cfg.xml from the annotated classes? I could probably write something, but I don't believe I'm the first person to think of this.
 
ranger
Posts: 17344
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jon Strayer wrote:Is there a way to generate the mapping elements of hibernate.cfg.xml from the annotated classes? I could probably write something, but I don't believe I'm the first person to think of this.



Um, they would be unrelated. What can you get from the annotated class that goes into the hibernate.cfg.xml

The hibernate.cfg.xml is for SessionFactory and Hibernate configuration like show_sql and also to say that you are going to use a second level cache.

In the Annotated classes are specific to the class like its mapping to the database and named queries, nothing about the configuration of Hibernate or a SessionFactory.

Mark
 
Jon Strayer
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Mark Spritzler wrote:

Jon Strayer wrote:Is there a way to generate the mapping elements of hibernate.cfg.xml from the annotated classes? I could probably write something, but I don't believe I'm the first person to think of this.



Um, they would be unrelated. What can you get from the annotated class that goes into the hibernate.cfg.xml

The hibernate.cfg.xml is for SessionFactory and Hibernate configuration like show_sql and also to say that you are going to use a second level cache.

In the Annotated classes are specific to the class like its mapping to the database and named queries, nothing about the configuration of Hibernate or a SessionFactory.

Mark



The mapping elements contain the class names. The classes with the hibernate annotations would be the ones that go in the mapping elements.
 
You'll never get away with this you overconfident blob! The most you will ever get is this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!