Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LocalSessionFactoryBean doesn't support JPA 2.1 auto-apply @Converter on Hibernate 4.3 [SPR-12234] #16849

spring-issuemaster opened this issue Sep 22, 2014 · 2 comments


Copy link

@spring-issuemaster spring-issuemaster commented Sep 22, 2014

Samuel Fung opened SPR-12234 and commented

I use JPA @Converter with auto-apply. It works with Hibernate Configuration, but fails with Spring LocalSessionFactoryBean. See ConvertTest and SpringConvertTest respectively in attached testcase.

org.hibernate.MappingException: Could not determine type for: test.convert.MyType, at table: Parent, for columns: [org.hibernate.mapping.Column(myType)]
at org.hibernate.mapping.SimpleValue.getType(
at org.hibernate.mapping.SimpleValue.isValid(
at org.hibernate.mapping.Property.isValid(
at org.hibernate.mapping.PersistentClass.validate(
at org.hibernate.mapping.RootClass.validate(
at org.hibernate.cfg.Configuration.validate(
at org.hibernate.cfg.Configuration.buildSessionFactory(
at org.hibernate.cfg.Configuration.buildSessionFactory(
at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(
at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(
... 40 more

LocalSessionFactoryBean only works when @Convert(converter=MyConverter.class) is explicitly declared at property Parent.myType.

Walking through the source, LocalSessionFactoryBuilder.defaultTypeFilters includes scanning of @Converter and eventually calls addAnnotatedClass(); addAttributeConverter() should be called instead.

Affects: 4.1 GA


Issue Links:

  • #15425 Add support for discovering JPA 2.1 @Converter during scanning

Referenced from: commits f9452ae


This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Sep 22, 2014

Juergen Hoeller commented

This should work in 4.1.1 now. Please give the upcoming 4.1.1 snapshot a try and let me know whether it works for you...



This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Sep 22, 2014

Samuel Fung commented

Yes, 4.1.1 snapshot works well. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.