Brian Xu
Brian Xu

Reputation: 71

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

Upvotes: 2

Views: 1318

Answers (1)

Brian Xu
Brian Xu

Reputation: 71

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

Upvotes: 2

Related Questions