• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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: 4885
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.
 
keep an eye out for scorpions and black widows. But the tiny ads are safe.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic