title: EJB 3.1 Embedded API - Unit test EJB + JPA entities
body: <p>Has anyone done this or attempted to do this for a preexisting project?<br>
  It seems there are two options to go with here, either using the <a href="http://docs.sun.com/app/docs/doc/821-1208/gjlde?l=en&amp;a=view" rel="nofollow noreferrer">embedded EJB API</a> basically the following class  </p>
  
  <pre><code>javax.ejb.embeddable.EJBContainer
  </code></pre>
  
  <p>Which expects a configured glassfish v3 install to be available (application scoped resources will make this easier).</p>
  
  <p>The alternative is using the embedded glassfish jar files and the <a href="http://docs.sun.com/app/docs/doc/821-1208/giijw?l=en&amp;a=view" rel="nofollow noreferrer">embedded glassfish API</a>  </p>
  
  <p>I am looking for feedback from someone who has or who is in the process of doing this, links to blogs etc with a simple EJB &amp; test case are dime a dozen.</p>
  
  <p>If you've done this with any other EJB 3.1 container feel free to share.</p>
  
  <ol>
  <li>Did you use any particular test framework for reasons other than it been your preferred tool?  </li>
  <li>Which JPA 2.0 implementation did you use, and was there a particular reason for doing so?</li>
  <li>If you used glassfish which of the above strategies did you use? If not then which EJB 3.1 container did you use?</li>
  <li>If you successfully did this, was it worth the effort and would you do this again for another existing project?</li>
  </ol>