• 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
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

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

 
Ranch Hand
Posts: 1732
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: 3272
296
Android Chrome Eclipse IDE
  • 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: 3272
296
Android Chrome Eclipse IDE
  • 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!