org.hibernate.MappingException: Could not determine type for: test.convert.MyType, at table: Parent, for columns: [org.hibernate.mapping.Column(myType)]

Spring JIRA | Samuel Fung | 2 years ago
  1. 0

    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(SimpleValue.java:336) at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:310) at org.hibernate.mapping.Property.isValid(Property.java:241) at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:496) at org.hibernate.mapping.RootClass.validate(RootClass.java:270) at org.hibernate.cfg.Configuration.validate(Configuration.java:1358) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1849) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1928) at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:363) at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:453) at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:438) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1627) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1564) ... 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.

    Spring JIRA | 2 years ago | Samuel Fung
    org.hibernate.MappingException: Could not determine type for: test.convert.MyType, at table: Parent, for columns: [org.hibernate.mapping.Column(myType)]
  2. 0

    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(SimpleValue.java:336) at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:310) at org.hibernate.mapping.Property.isValid(Property.java:241) at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:496) at org.hibernate.mapping.RootClass.validate(RootClass.java:270) at org.hibernate.cfg.Configuration.validate(Configuration.java:1358) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1849) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1928) at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:363) at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:453) at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:438) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1627) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1564) ... 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.

    Spring JIRA | 2 years ago | Samuel Fung
    org.hibernate.MappingException: Could not determine type for: test.convert.MyType, at table: Parent, for columns: [org.hibernate.mapping.Column(myType)]
  3. 0

    org.hibernate.MappingException: Unable to find column with logical name:

    Stack Overflow | 4 years ago | diminuta
    org.hibernate.MappingException: Unable to find column with logical name: nasi in participante
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Multiple occurrence of custom CompositeUserType in Hibernate causing MappingException

    Stack Overflow | 5 years ago | Overloaded
    org.hibernate.MappingException: property mapping has wrong number of columns: com.mytest.walking.Trail.Destination type: com.mytest.walking.LocationType
  6. 0

    org.hibernate.MappingException: Could not determine type for: (foo)

    Stack Overflow | 1 year ago | user1584500
    org.hibernate.MappingException: Could not determine type for: dom.ClassB, at table: ClassA, for columns: [org.hibernate.mapping.Column(classB)]

  1. Kawada 6 times, last 6 months ago
  2. kuldeep 16 times, last 3 months ago
  3. esaar 1 times, last 4 months ago
  4. r1chjames 1 times, last 6 months ago
  5. Harsh 1 times, last 8 months ago
34 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. 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()
  2. Hibernate
    Configuration.buildSessionFactory
    1. org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:336)
    2. org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:310)
    3. org.hibernate.mapping.Property.isValid(Property.java:241)
    4. org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:496)
    5. org.hibernate.mapping.RootClass.validate(RootClass.java:270)
    6. org.hibernate.cfg.Configuration.validate(Configuration.java:1358)
    7. org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1849)
    8. org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1928)
    8 frames
  3. Spring ORM
    LocalSessionFactoryBean.afterPropertiesSet
    1. org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:363)
    2. org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:453)
    3. org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:438)
    3 frames
  4. Spring Beans
    AbstractAutowireCapableBeanFactory.initializeBean
    1. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1627)
    2. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1564)
    2 frames