• 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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

 
Ranch Foreman
Posts: 1897
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: 3341
303
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: 3341
303
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....
 
Wanna see my flashlight? How about this tiny ad?
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic