wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Why two xml files? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Why two xml files?" Watch "Why two xml files?" New topic
Author

Why two xml files?

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243
    
    1

Guys,

What is the need for orm.xml and persistence.xml files?


SCJP 1.4, SCWCD 1.4 - Hints for you, SCBCD Hints - Demnachst, SCDJWS - Auch Demnachst
Did a rm -R / to find out that I lost my entire Linux installation!
Leandro Siqueira
Greenhorn

Joined: Jun 05, 2005
Posts: 6
  • 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

    Joined: Sep 26, 2006
    Posts: 9243
        
        1

    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

    Joined: Jun 05, 2005
    Posts: 6
    exactly!

    and if you have both, xml overrides the annotations.
    Joe Harry
    Ranch Hand

    Joined: Sep 26, 2006
    Posts: 9243
        
        1

    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.
    Chaminda Amarasinghe
    Ranch Hand

    Joined: May 17, 2006
    Posts: 402
    Yes you are correct
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Why two xml files?
     
    Similar Threads
    ClassNotFoundException in Jsp Precompilation
    How to create a war file.
    Need to Convert Documents to HTML
    WA #1.....word association
    Componentized logic in views - what to use.