org.hibernate.AssertionFailure: the annotation property autoApply of annotation javax.persistence.Converter is not of type boolean

Hibernate JIRA | Christian Bauer | 4 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    In JandexHelper the method {{public static <T> T getValue(AnnotationInstance annotation, String element, Class<T> type)}} calls {{annotation.value( element );}} This returns a {{Boolean}} if the annotation value is actually a {{boolean}}. The following type.cast() fails. As far as I can tell, this only affects reading the {{@Converter(autoApply)}} annotation in the current codebase. Reproduce by adding an {{@Converter}} annotated class to the persistence unit, e.g. {code} <class>org.jpwh.model.converter.MonetaryAmountConverter</class> {code} {code} [main ] ERROR - 14:01:29,37 - org.hibernate.AssertionFailure: HHH000099: an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session): org.hibernate.AssertionFailure: the annotation property autoApply of annotation javax.persistence.Converter is not of type boolean org.hibernate.AssertionFailure: the annotation property autoApply of annotation javax.persistence.Converter is not of type boolean at org.hibernate.metamodel.source.annotations.JandexHelper.getValue(JandexHelper.java:110) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.prepareMetadataSources(EntityManagerFactoryBuilderImpl.java:377) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:210) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:172) at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:43) at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:135) at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:81) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55) {code}

    Hibernate JIRA | 4 years ago | Christian Bauer
    org.hibernate.AssertionFailure: the annotation property autoApply of annotation javax.persistence.Converter is not of type boolean
  2. 0

    In JandexHelper the method {{public static <T> T getValue(AnnotationInstance annotation, String element, Class<T> type)}} calls {{annotation.value( element );}} This returns a {{Boolean}} if the annotation value is actually a {{boolean}}. The following type.cast() fails. As far as I can tell, this only affects reading the {{@Converter(autoApply)}} annotation in the current codebase. Reproduce by adding an {{@Converter}} annotated class to the persistence unit, e.g. {code} <class>org.jpwh.model.converter.MonetaryAmountConverter</class> {code} {code} [main ] ERROR - 14:01:29,37 - org.hibernate.AssertionFailure: HHH000099: an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session): org.hibernate.AssertionFailure: the annotation property autoApply of annotation javax.persistence.Converter is not of type boolean org.hibernate.AssertionFailure: the annotation property autoApply of annotation javax.persistence.Converter is not of type boolean at org.hibernate.metamodel.source.annotations.JandexHelper.getValue(JandexHelper.java:110) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.prepareMetadataSources(EntityManagerFactoryBuilderImpl.java:377) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:210) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:172) at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:43) at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:135) at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:81) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55) {code}

    Hibernate JIRA | 4 years ago | Christian Bauer
    org.hibernate.AssertionFailure: the annotation property autoApply of annotation javax.persistence.Converter is not of type boolean

    Root Cause Analysis

    1. org.hibernate.AssertionFailure

      the annotation property autoApply of annotation javax.persistence.Converter is not of type boolean

      at org.hibernate.metamodel.source.annotations.JandexHelper.getValue()
    2. Hibernate
      JandexHelper.getValue
      1. org.hibernate.metamodel.source.annotations.JandexHelper.getValue(JandexHelper.java:110)
      1 frame
    3. org.hibernate.jpa
      HibernatePersistenceProvider.createEntityManagerFactory
      1. org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.prepareMetadataSources(EntityManagerFactoryBuilderImpl.java:377)
      2. org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:210)
      3. org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:172)
      4. org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:43)
      5. org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:135)
      6. org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:81)
      6 frames
    4. JavaEE 7
      Persistence.createEntityManagerFactory
      1. javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
      1 frame