Spring Data JPA & MyBatis

荒凉一梦 提交于 2019-12-05 06:24:30

问题


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


回答1:


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 : )




回答2:


Spring Data MyBatis

If you would not like to use a JPA implementation like Spring-Data-JPA module, but you like use Spring-Data you can find Spring-Data-Mybatis a useful project.

I know that this is not precise answer to your question but I hope that this answer can be interesting.




回答3:


Spring-Data-Mybatis Hatunet version

I am using this project: https://github.com/hatunet/spring-data-mybatis

It fit very well with spring-data-mybatis and it have also the paginated repository.

Work very well on production project.



来源:https://stackoverflow.com/questions/33652936/spring-data-jpa-mybatis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!