Search code examples
spring-bootopenjpa

configure openjpa on to spring boot


Im trying to change the default JPA implementation of Hibernate to OpenJPA on Spring boot. Ive searched on google but there is not much on how to configure openJPA to Spring boot. Any advice would be helpful. Thanks


Solution

  • @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);
        }
    }