Category Archives: DB

Spring 3, Hibernate JPA, Tomcat transactions

I tried to deploy a webapp that uses Spring 3, JPA with the Hibernate implementation and Tomcat. There are domain classes with a DAO layer which is called from the Service layer. The classes are annotated correctly. All of the unit tests work. Actually the whole webapp works deployed on other web containers : but […]

Also posted in Hibernate, JPA, Spring Framework | Tagged , , | Leave a comment

Spring STS 2.6 JPA template project

Here are a few tips on using the JPA project template included in the Eclipse based SpringSource Tool Suite (STS) (currently at version 2.6) which is a free download from SpringSource. Createe a JPA “utility” project (New->Spring Template Project then choose Simple Spring JPA Utility Project). This generates a lot more than just an empty […]

Also posted in Hibernate, JPA, Spring Framework | Leave a comment

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. […]

Also posted in JPA, Spring Framework | 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 […]

Also posted in JPA, Websphere | Tagged , , | Leave a comment

Spring and Transactions

I’ve been taking a legacy codebase, putting testing in place and refactoring. For DB access I retrofitted the persistence classes to be injected via Spring with a DataSource instead of looking them up via JNDI. IN my Spring context I defined a PlatformTransactionManager.

Then I refer to it in the the test case class. […]

Also posted in Spring Framework, Testing | Tagged , | Leave a comment

Oh My, Oracle and Sun are buying

Sun Microsystems Announces Agreement to Acquire MySQL, Developer of the World’s Most Popular Open Source Database And then Oracle announces that it’s buying BEA. (Will it become BEAL? Bill, Ed, Alfred and Larry?)

Also posted in News, Weblogic | Tagged , , , | Leave a comment

Europa woes with JPA and Dali

I was looking forward to the Europa Eclipse release. There are nice things included. But,… For an all-in-one jee download you also had to go to the update manager to download DTP “enablement” to do anything. Poor out-of-the-box experience right away. After updating and rebooting I get this in a dialog box after the “resynching” […]

Also posted in IDE, JPA | Tagged , , | 1 Response

Run hsqldb from Eclipse

Introduction You may be running HSQLDB from an ANT script or a batch file. You can create an Eclipse run configuration to start and stop the HSQLDB server from within Eclipse. As a bonus when you export your project ANT scripts there will be a target created to run the server from ANT. Project Setup […]

Also posted in Eclipse | Tagged , | Leave a comment