This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
  • 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

Testing jpa part

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I am currently developing a JSF web app that uses services provided by a stateless session bean, that acts as a facade.
This session bean delegates to different pojos.
One of these pojos encapsulates all the JPA stuff. It uses an injected Persistent Context
@PersistenceContext(unitName = "myPU")
Everything work fine.

Now I would like to do some testing around this JPA pojo.
I woulld to use junit as all my other pojos are tested with junit.
But how can I do that ?
From my tests (out of container), how can I create a persistent manager based on the persistent unit name ?
I am using netbeans + glassfish.

Thanks for your help,
 
author
Posts: 580
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Olivier,

Have you looked into embedded GlassFish? It can be used inside JUnit.

Regards,
Reza
 
Olivier Scalbert
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the info, Reza
I will have a look to embedded glassfish.

By the way I have your book opened on my desk !!!
;-)

Olivier
 
Reza Rahman
author
Posts: 580
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Olivier,

Good to hear :-). I hope that it is helping. Do let me know if you have questions or comments. I can be reached here: reza_rahman@lycos.com. I can put it on the plan for the second edition.

Cheers,
Reza

P.S.: If you get a chance, please do consider writing a review on Amazon or elsewhere. It really helps us out :-).
 
Weeds: because mother nature refuses to be your personal bitch. But this tiny ad is willing:
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