我试图在Spring启动时将Hibernate的默认JPA实现更改为OpenJPA。我在谷歌搜索但没有太多关于如何配置openJPA到Spring启动。任何意见将是有益的。感谢
答案 0 :(得分:2)
@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);
}
}