How to obtain JNDI data source for JPA/JTA DAO integration test?

Posted by HDave on Stack Overflow See other posts from Stack Overflow or by HDave
Published on 2010-06-09T17:59:11Z Indexed on 2010/06/09 18:02 UTC
Read the original article Hit count: 217

Filed under:
|
|
|
|

I have a JPA application that has specified JTA transactions in persistence.xml. For whatever reason, I have found that when using JTA, you MUST specify a JNDI data source within persistence.xml as well. This is fine, unless you are trying to go integration testing outside a container and JNDI is not available.

My questions are:

a) is there anyway to inject a jdbc datasource into my JTA transaction manager? b) if not, how do a handle a JNDI lookup during integration testing?

© Stack Overflow or respective owner

Related posts about jpa

Related posts about datasource