Spring JPA and persistence.xml?

Just to confirm though you probably did... Did you include the bits in your application context. Xml? Also I'm not so sure you'd be able to use a jta transaction type with this kind of setup?

Wouldn't that require a data source managed connection pool? So try RESOURCE_LOCAL instead.

I'm confused. You're injecting a PU into the service layer and not the persistence layer? I don't get that.

I inject the persistence layer into the service layer. The service layer contains business logic and demarcates transaction boundaries. It can include more than one DAO in a transaction.

I don't get the magic in your save() method either. How is the data saved? In production I configure spring like this: along with the reference in web.

Xml For unit testing I do this.

I have a test application set up using JPA/ and my configuration mirrors yours with the exception that I create a datasource and inject it into the EntityManagerFactory, and moved the datasource specific properties out of the persistenceUnit and into the datasource. With these two small changes, my EM gets injected properly.

This may be old, but if anyone has the same problem try changing unitname to just name in the PersistenceContext annotation: From @PersistenceContext(unitName="educationPU") to @PersistenceContext(name="educationPU").

The optional name attribute of @PersistenceContext is used to look up the injected entity manager. It has no corresponding element in persistence.xml. If this worked for you, this is IMO just a lucky side effect related to the absence of unitName (the behavior in this case is vendor-specific).

But this is not correct. – Pascal Thivent Jul 14 '10 at 23:02.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions