This week's book giveaways are in the Cloud and AI/ML forums.
We're giving away four copies each of Cloud Native Patterns and Natural Language Processing and have the authors on-line!
See this thread and this one for details.
Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML 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
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

my exam cloud mock 2, file structure of the ear file in the question

 
Ranch Hand
Posts: 1742
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


You have the following:
1. An enterprise archive (EAR) with one persistence unit with unit name "TestPU".
2. A ejb-jar with one stateless session bean bundled in application module (EAR file)
Which code, when added to the stateless session bean class, injects a container-managed persistence context at runtime?


I assume the file structure is:
project.ear
     - lib/testpu.jar
           -- /META-INF/orm.xml  
           -- Employee.class
           -- Phone.class
           -- and etc (for example)
      - beans.jar
         -- META-INF/persistence.xml
          -- BeanService.class (the stateless bean) that injects the entity manager with persistence unit called TestPU.

I assume in the META-INF/persistence.xml of beans.jar, there is :
<persistence-unit name="TestPU">
   <mapping-file>META-INF/orm.xml</mapping-file>
   <jar-file>lib/testpu.jar</jar-file>
</persistence-unit>
 
Creator of Enthuware JWS+ V6
Posts: 3289
296
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree (you could even do without the orm.xml file and mapping-file reference, if annotations are used)
 
Frits Walraven
Creator of Enthuware JWS+ V6
Posts: 3289
296
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hmm, re-reading this makes me doubt: An enterprise archive (EAR) with one persistence unit with unit name "TestPU".

This implies that the persistence.xml is defined inside the EAR and that is only possible inside a jar file in the EAR library directory.... or do they mean it is defined in the EJB-JAR-file? Not clear to me, an apart from that the EJB-JAR is bundled in an EAR (2) but they don't say it is the same EAR as in 1....
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!