I spent days and days trying to get a working database connection for my Spring/JPA(Hibernate) integration tests, troubleshooting mysterious \"No Database Context Found\" errors
First of all I am not sure why to use it but I do know that it is not mandatory to use it
From the API Docs,
Specify the JpaVendorAdapter implementation for the desired JPA provider, if any. This will initialize appropriate defaults for the given provider, such as persistence provider class and JpaDialect, unless locally overridden in this FactoryBean.
The way I understand it, is an alternative to the way we specify the hibernate configurations. I did not use it, nor did I find it on Spring API docs. It is not mandatory, let it be initialized to the default value.
There are even some issues in spring with jpaVendorAdapter
told in their JIRA.
Also there is an SO question here.
I just found the answer to my question in a post on coderanch.com.
Looks like I can circumvent the use of a JpaVendorAdapter if I just specify the JPA provider inside the persistence unit definition in persistence.xml like this:
<persistence-unit name="myPU" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
.
.
.