我從休眠3遷移到休眠4, 在休眠3,我註冊的自定義類型的方式在Hibernate中註冊自定義的類型是:如何使用org.springframework.orm.hibernate4.LocalSessionFactoryBean
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;
}}
我現在試圖做同樣的操作,但使用休眠4,我的問題是如何做到這一點的最佳方式?因爲我沒有訪問時使用「org.springframework.orm.hibernate4.LocalSessionFactoryBean」而不是「org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean」更改配置。
感謝
我必須在那裏添加該功能? – Aitch