Monthly Archives: July 2009

Spring, BasicDataSource and OpenJPA

So you want to use Spring with commons BasicDataSource and OpenJPA? There is an interesting gotcha. Let’s start with just the DriverManager DataSource for comparison. In your spring context you define the datasource like this:

Then your EntityManager Factory:

Here META-INF/persistence.xml is almost empty because all the properties are specified here in Spring. […]

Posted in JPA, Spring Framework | Tagged , , , | 1 Response

Spring Test Framework CoC suggestion

Let’s say you’re using JUnit 4 and the Spring Testing classes (the 2.5+ versions) for your unit tests. You can specify parameters as shown in the TransactionConfiguration annotation as shown in this example. But you can also get away with leaving them out in a nod to the uberhip Convention Over Configuration gods as shown […]

Posted in Spring Framework, Testing | Tagged , , | 1 Response

Multiple Persistence Units – Websphere v7, OpenJPA

Want to do something exotic like specifying two persistence units in your persistence.xml file? Perhaps one local and one JTA managed. Maybe even go whole hog and do that to write unit tests? In Websphere v7 (RAD 7.5) when you have multiple PUs in persistence.xml it barfs like this:

Here is IBM’s “help”: http://publib.boulder.ibm.com/infocenter/dmndhelp/v6r2mx/index.jsp?topic=com.ibm.websphere.wbpm.messages.620.doc/messages/com.ibm.ws.jpa.jpa.html […]

Posted in JPA, Websphere | Tagged , , | Leave a comment