• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

The root of a persistence unit

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Enthuware, there is a question:
"
A persistence archive file named ejbplusPU.jar contains the following files:

com/enthu/ejbplus/Account.class
com/enthu/ejbplus/Person.class
META-INF/persistence.xml
META-INF/orm.xml

Given that Account and Person classes contain all the mapping information in the form of annotations, which of the above files will always be examined by the container when this jar is deployed? "

My answer is "persistence.xml" and "orm.xml", but no class files.

But the correct answer includes those class files.

According to persistence spec, "Any annotated managed
persistence classes found in the root of the persistence unit are added to the list of managed persistence classes."

Here, Account.class and Person.class aren't at the root of the persistence unit, so why should they be examined?
 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you tell me the exam no and and question no?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JPA spec states the following:

"The jar file or directory whose META-INF directory contains the persistence.xml file is termed the root of the persistence unit."

As your Account and Person class are part of this jar file, they are seen as "annotated managed persistence classes found in the root of the persistence unit".
[ November 21, 2008: Message edited by: Kristel Nieuwenhuys ]
 
Tang Yue
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,Kristel
You mean, any class file found in the root of the persistence unit, or the subdirectories of the root of the persistene unit is evaluated?
 
Enthuware Software Support
Posts: 4897
60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for pointing it out. The question should make it clear that Account and Person class belong to com.enthu.ejbplus package, in which case, they are positioned correctly in the jar file and will be inspected by the container for annotations.
 
Everyone is a villain in someone else's story. Especially this devious tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic