I am trying to use Spring Data JPA with MyBatis. Since there isnt a Vendor Adapter for MyBatis, what is the alternative here?
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan" value="com.abc.xyz.domain"/>
</bean>
I am getting the below exception when I tried to initialize my application.
Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: No PersistenceProvider specified in EntityManagerFactory configuration, and chosen PersistenceUnitInfo does not specify a provider class name either
Thanks
Mybatis does not implement JPA. Mybatis is not ORM Framework. JPA is ORM Specification which is implemented by Hibernate, Toplink, Eclipselink . Since Mybatis does not mplement JPA, it does not come under the list of JPA providers. Hence, you cannot use mybatis as a JPA framework. Mybatis is a data mapper framework which is completely different framework compared to JPA. In JPA and ORM frameworks, you map Objects /Entities to the corresponding sql tables and you work on objects and not on tables directly unless you use their native queries. In mybatis , you play directly with sql data.. Hope this clears the difference between mybatis and JPA. Hence when you want mybatis with spring data you use spring data mybatis independently and not spring data JPA.
Why not try spring-data-jpa-extra
It provide a dynamic query solution for spring-data-jpa like mybatis, but much easier than mybatis.
I think you would like it : )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With