How to register a custom type in Hibernate using org.springframework.orm.hibernate4.LocalSessionFactoryBean
- by Luis
I'm migrating from hibernate 3 to hibernate 4,
In hibernate 3 the way I was registering a custom type was:
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;
}}
I'm now trying to do the same operation but using hibernate 4, my question is how is the best way to do this? since I dont have access do change configuration when using "org.springframework.orm.hibernate4.LocalSessionFactoryBean" instead of "org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean".
Thanks