Tag Archives: OpenJPA

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: 1 2 3 4 <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" p:driverClassName="org.hsqldb.jdbcDriver" p:url="jdbc:hsqldb:hsql://localhost:9001/testdb" p:username="sa" p:password="" /> Then your EntityManager Factory: 1 2 3 [...]

Posted in JPA, Spring Framework | Also tagged , , | Leave a comment

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: [7/8/09 10:01:55:149 EDT] 00000053 servlet       I [...]

Posted in JPA, Websphere | Also tagged , | Leave a comment