File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Testing jpa part Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Testing jpa part" Watch "Testing jpa part" New topic
Author

Testing jpa part

Olivier Scalbert
Greenhorn

Joined: May 07, 2004
Posts: 25
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,
Reza Rahman
author
Ranch Hand

Joined: Feb 01, 2005
Posts: 580
    
    5
Olivier,

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

Regards,
Reza


Independent Consultant — Author, EJB 3 in Action — Expert Group Member, Java EE 6 and EJB 3.1
Olivier Scalbert
Greenhorn

Joined: May 07, 2004
Posts: 25
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
Ranch Hand

Joined: Feb 01, 2005
Posts: 580
    
    5
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 :-).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Testing jpa part