hibernate3からhibernate4に移行しています。hibernate3では、カスタムタイプを登録する方法は次のとおりです。
public class AnnotationSessionFactoryBean extends org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean {
private Collection<? extends BasicType> customTypes;
public Collection<? extends BasicType> getCustomTypes() {
return customTypes;
}
public void setCustomTypes(Collection<? extends BasicType> customTypes) {
this.customTypes = customTypes;
}
@Override
protected Configuration newConfiguration() throws HibernateException {
Configuration configuration = super.newConfiguration();
if (CollectionUtils.hasEntries(customTypes)) {
for (BasicType customType:customTypes) {
configuration.registerTypeOverride(customType);
}
}
return configuration;
}}
私は今同じ操作を行おうとしていますが、Hibernate 4を使用していますが、私の質問はこれを行うための最良の方法は何ですか?「org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean」の代わりに「org.springframework.orm.hibernate4.LocalSessionFactoryBean」を使用すると、アクセス権がないため、構成を変更できます。
ありがとう