org.hibernate.MappingException: Could not determine type for: BasicType adapter for AttributeConverter<Name,String>, at table: History_Party, for columns: [org.hibernate.mapping.Column(name)]

Stack Overflow | MarcG | 3 years ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    Without a JPA 2.1 Converter, the Party entity below fails at Configuration.buildSessionFactory() as it should, since Hibernate doesn't know what to do with the Name class: {code} @Entity @Audited public class Party { protected Name name; ... } {code} The exception is: {code} org.hibernate.MappingException: Could not determine type for: ModuloADM.Party.Name, at table: Party, for columns: [org.hibernate.mapping.Column(name)] {code} To fix this, I then add this converter: {code} @Converter (autoApply=true) public class NametoStringConverter implements AttributeConverter<Name, String> { ... } {code} And the exception now changes to: {code} org.hibernate.MappingException: Could not determine type for: BasicType adapter for AttributeConverter<Name,String>, at table: History_Party, for columns: [org.hibernate.mapping.Column(name)] {code} This is now failing at the Envers auditing table for the Party entity. Note that History_Party is the name of the audit table, as choosen by config.setProperty("org.hibernate.envers.audit_table_prefix", "History_"). The complete stacktrace is: {code} org.hibernate.MappingException: Could not determine type for: BasicType adapter for AttributeConverter<Name,String>, at table: History_Party, for columns: [org.hibernate.mapping.Column(name)] at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:336) at org.hibernate.tuple.PropertyFactory.buildEntityBasedAttribute(PropertyFactory.java:246) at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:227) at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:520) at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:148) at sun.reflect.GeneratedConstructorAccessor43.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:163) at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:135) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:401) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1857) {code}

    Hibernate JIRA | 3 years ago | Marcelo Glasberg
    org.hibernate.MappingException: Could not determine type for: BasicType adapter for AttributeConverter<Name,String>, at table: History_Party, for columns: [org.hibernate.mapping.Column(name)]
  2. 0

    Hibernate Envers fails with @Converter and AttributeConverter (JPA 2.1)

    Stack Overflow | 3 years ago | MarcG
    org.hibernate.MappingException: Could not determine type for: BasicType adapter for AttributeConverter<Name,String>, at table: History_Party, for columns: [org.hibernate.mapping.Column(name)]
  3. 0

    Without a JPA 2.1 Converter, the Party entity below fails at Configuration.buildSessionFactory() as it should, since Hibernate doesn't know what to do with the Name class: {code} @Entity @Audited public class Party { protected Name name; ... } {code} The exception is: {code} org.hibernate.MappingException: Could not determine type for: ModuloADM.Party.Name, at table: Party, for columns: [org.hibernate.mapping.Column(name)] {code} To fix this, I then add this converter: {code} @Converter (autoApply=true) public class NametoStringConverter implements AttributeConverter<Name, String> { ... } {code} And the exception now changes to: {code} org.hibernate.MappingException: Could not determine type for: BasicType adapter for AttributeConverter<Name,String>, at table: History_Party, for columns: [org.hibernate.mapping.Column(name)] {code} This is now failing at the Envers auditing table for the Party entity. Note that History_Party is the name of the audit table, as choosen by config.setProperty("org.hibernate.envers.audit_table_prefix", "History_"). The complete stacktrace is: {code} org.hibernate.MappingException: Could not determine type for: BasicType adapter for AttributeConverter<Name,String>, at table: History_Party, for columns: [org.hibernate.mapping.Column(name)] at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:336) at org.hibernate.tuple.PropertyFactory.buildEntityBasedAttribute(PropertyFactory.java:246) at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:227) at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:520) at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:148) at sun.reflect.GeneratedConstructorAccessor43.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:163) at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:135) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:401) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1857) {code}

    Hibernate JIRA | 3 years ago | Marcelo Glasberg
    org.hibernate.MappingException: Could not determine type for: BasicType adapter for AttributeConverter<Name,String>, at table: History_Party, for columns: [org.hibernate.mapping.Column(name)]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Hibernate 4.3.11 - Envers fails with ZonedDateTime field

    Stack Overflow | 1 month ago | phdias
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
  6. 0

    Spring Envers fails with @Converter and AttributeConverter<LocalDate,Date>

    Stack Overflow | 10 months ago | Med
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/spring-config/db-mysql-context.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory

    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: BasicType adapter for AttributeConverter<Name,String>, at table: History_Party, for columns: [org.hibernate.mapping.Column(name)]

      at org.hibernate.mapping.SimpleValue.getType()
    2. Hibernate
      SingleTableEntityPersister.<init>
      1. org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:336)
      2. org.hibernate.tuple.PropertyFactory.buildEntityBasedAttribute(PropertyFactory.java:246)
      3. org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:227)
      4. org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:520)
      5. org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:148)
      5 frames
    3. Java RT
      Constructor.newInstance
      1. sun.reflect.GeneratedConstructorAccessor43.newInstance(Unknown Source)
      2. sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      3. java.lang.reflect.Constructor.newInstance(Constructor.java:525)
      3 frames
    4. Hibernate
      Configuration.buildSessionFactory
      1. org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:163)
      2. org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:135)
      3. org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:401)
      4. org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1857)
      4 frames