一尘不染

配置openjpa以启动Spring

spring-boot

我试图在Spring启动时将默认的Hibernate
JPA实现更改为OpenJPA。香港专业教育学院搜索谷歌,但没有太多关于如何配置openJPA到Spring启动。任何意见将是有益的。谢谢


阅读 309

收藏
2020-05-30

共1个答案

一尘不染

@Configuration
public class OpenJPAConfig extends JpaBaseConfiguration {
    protected OpenJPAConfig(DataSource dataSource, JpaProperties properties,
                            ObjectProvider<JtaTransactionManager> jtaTransactionManager,
                            ObjectProvider<TransactionManagerCustomizers> transactionManagerCustomizers) {
        super(dataSource, properties, jtaTransactionManager, transactionManagerCustomizers);
    }

    @Override
    protected AbstractJpaVendorAdapter createJpaVendorAdapter() {
        return new OpenJpaVendorAdapter();
    }
    @Override
    protected Map<String, Object> getVendorProperties() {
        return new HashMap<>(0);
    }
}
2020-05-30