Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Why two xml files?

 
Ranch Hand
Posts: 10192
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

What is the need for orm.xml and persistence.xml files?
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
  • persistence.xml defines the identities and configuration properties of persistence units;
  • orm.xml is optional and defines the mapping between classes and persistence units.



  • [ October 22, 2008: Message edited by: Leandro Siqueira ]
    [ October 22, 2008: Message edited by: Leandro Siqueira ]
     
    Joe Harry
    Ranch Hand
    Posts: 10192
    3
    Mac PPC Eclipse IDE Ubuntu
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    If I do not provide an orm.xml file, then the persistence provider will automatically map my POJO's based on the metadata annotations that I have. Am I right in this sense?
     
    Leandro Siqueira
    Greenhorn
    Posts: 6
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    exactly!

    and if you have both, xml overrides the annotations.
     
    Joe Harry
    Ranch Hand
    Posts: 10192
    3
    Mac PPC Eclipse IDE Ubuntu
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    If I were to relate this with Hibernate, a persistence.xml is something like a hibernate-cfg.xml and the orm.xml is like a mapping xml that we have in Hibernate.
     
    Ranch Hand
    Posts: 413
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Yes you are correct
     
    It's just like a fortune cookie, but instead of a cookie, it's pie. And we'll call it ... tiny ad:
    Thread Boost feature
    https://coderanch.com/t/674455/Thread-Boost-feature
      Bookmark Topic Watch Topic
    • New Topic