The following section of the documentation contains an example of
referencing a database from outside the container.
http://docsview.sfbay/app/docs/doc/819-3672/6n5sj2sj9?a=view
June
Craig L Russell wrote On 05/01/07 11:20 PM,:
> Hi Sud,
>
> Generally, when running outside a container, you don't have access to
> resources normally managed by the container and made available via
> JNDI lookup.
>
> For datasources, this means that you need to define the JDBC
> properties and connection pooling properties directly to your jpa
> provider. The documentation shows which properties you need to set in
> the persistence.xml or in the properties map you pass to the EMF
> Persistence.createEntityManagerFactory method.
>
> Craig
>
> On May 1, 2007, at 3:51 PM, sud wrote:
>
>> I have a EJB 3.0 application that uses JPA and exposes CRUD
>> operations to a database. The jta-data-source in persistence.xml
>> refers to a JDBC resource defined in JNDI.
>>
>> I'd like to use TestNG to run unit tests for this application. I
>> believe I need to setup out of container tests. Since the EJBs are
>> POJOs I can easily run test cases for them. But I don't know how to
>> setup and access the JDBC resource defined in JNDI from out-side the
>> container. I would appreciate any pointers.
>>
>> Thanks
>> -sud
>>
>> ------------------------------------------------------------------------
>> Ahhh...imagining that irresistible "new car" smell?
>> Check out new cars at Yahoo! Autos.
>> <http://us.rd.yahoo.com/evt=48245/*http://autos.yahoo.com/new_cars.html;_ylc=X3oDMTE1YW1jcXJ2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDbmV3LWNhcnM->
>
>
> Craig Russell
>
> Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
>
> 408 276-5638 mailto:Craig.Russell_at_sun.com
>
> P.S. A good JDO? O, Gasp!
>
>