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

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 :-).
 
reply
    Bookmark Topic Watch Topic
  • New Topic