This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes provider tag in persistence.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "provider tag in persistence.xml" Watch "provider tag in persistence.xml" New topic

provider tag in persistence.xml

Christophe Verré

Joined: Nov 24, 2005
Posts: 14687

I was trying to make a sample using Spring3 and JPA2. The persistence provider is Hibernate.
It might be a Spring-related issue, but I'm not sure, so I ask here first.

My persistence.xml was looking like this :

I was getting the following error :

I solved it by adding the provider tag in persistence.xml :

Why doesn't it work without the provider tag ? The hibernate documentation says:
The provider is a fully-qualified class name of the EJB Persistence provider. You do not have to define it if you don't work with several EJB3 implementations. This is needed when you are using multiple vendor implementations of EJB Persistence.
I'm using a standalone application, so I don't think that I need to set the provider tag. Or could it be that I have several providers on my classpath ?

[My Blog]
All roads lead to JavaRanch
Matt Kirk

Joined: Nov 03, 2011
Posts: 1
Hi Christophe,

Did you ever get an answer on this topic?

Don't get me started about those stupid light bulbs.
subject: provider tag in persistence.xml
Similar Threads
Could not resolve a persistence unit corresponding to the persistence-context-ref-name
Problem javax.persistence.NoResultException: No entity found for query
How to use JTA with JPA
EJB & JPA Unexpected Results
Is it possible to store persistence.xml outside JAR-file?