问题:我将使用@ vlad-mihalcea的Hibernate-Types。但我需要使用自己的ObjectMapper实例(Spring bean)。怎么做?
详细信息:Vald解释here如何注册自定义ObjectMapper。但是我仍然不知道在哪里准确添加属性。
是否应将properties
对象传递给LocalContainerEntityManagerFactoryBean
,如下所示?
@Bean
@Primary
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
EntityManagerFactoryBuilder builder,
DataSource dataSource,
JpaProperties jpaProperties,
JpaSchemaGenerationProperties schemaGenerationProperties) {
LocalContainerEntityManagerFactoryBean factory = builder
.dataSource(dataSource)
.packages("foo", "bar")
.persistenceUnit("default")
.properties(jpaProperties.getHibernateProperties(dataSource))
.build();
Map<String, Object> jpaPropertyMap = createDefaultJPAConfigMap(env, schemaGenerationProperties);
// Should I add the property here?
factory.setJpaPropertyMap(jpaPropertyMap);
return factory;
}