首页 > 解决方案 > 如何在 spring-boot-starter-data-jpa 中配置 org.hibernate.cfg.Configuration

问题描述

我使用 spring-boot-starter-data-jpa,我想在 Hibernate 中注册一个自定义的 BasicType。

根据休眠文档,我需要 org.hibernate.cfg.Configuration 对象来注册。

configuration.registerTypeContributor( (typeContributions, serviceRegistry) -> {
    typeContributions.contributeType( BitSetType.INSTANCE );
} );

但是在 spring-boot 中我不知道如何获取 org.hibernate.cfg.Configuration。

有谁知道该怎么做?

标签: javahibernatespring-bootspring-data-jpa

解决方案


推荐阅读