org.hibernate.bytecode.enhance.EnhancementException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • When trying to enhance classes annotated with @Entity or @Embeddable at build-time, hibernate-enhance-maven-plugin logs an EnhancementException "Unable to enhance persistent attribute [<class>:<attribute>]" for some association attributes (annotated with @ManyToOne, @OneToOne, ...). I've noticed that the error occurs only for classes containing attributes referencing classes that haven't been processed by the plugin yet. See the attached test project (hbm-enhance-test) to reproduce this issue. Here is an extract of the Maven log showing the issue: [INFO] Started enhance plugin..... [INFO] Processing Composite class file [hbm.test.Address]. [ERROR] Unable to enhance class [hbm.test.Address] org.hibernate.bytecode.enhance.EnhancementException: Unable to enhance persistent attribute [hbm.test.Address:country] at org.hibernate.bytecode.enhance.spi.Enhancer.enhancePersistentAttribute(Enhancer.java:367) ... (skipped) Caused by: javassist.NotFoundException: hbm.test.Country at javassist.ClassPool.get(ClassPool.java:450) at javassist.bytecode.Descriptor.toCtClass(Descriptor.java:592) at javassist.bytecode.Descriptor.toCtClass(Descriptor.java:542) at javassist.CtField.getType(CtField.java:371) at org.hibernate.bytecode.enhance.spi.Enhancer.resolveAttributeTypeDescriptor(Enhancer.java:1103) at org.hibernate.bytecode.enhance.spi.Enhancer.enhancePersistentAttribute(Enhancer.java:358) ... 28 more [INFO] Processing Entity class file [hbm.test.Country]. [INFO] Processing Entity class file [hbm.test.Director]. ... Note that the build doesn't fail, even though those classes are not enhanced. On Windows, version 4.3.8 of the plugin is also affected by issue HHH-9581, which will interfer while testing this issue.
    via by Johnny Macchione,
  • When trying to enhance classes annotated with @Entity or @Embeddable at build-time, hibernate-enhance-maven-plugin logs an EnhancementException "Unable to enhance persistent attribute [<class>:<attribute>]" for some association attributes (annotated with @ManyToOne, @OneToOne, ...). I've noticed that the error occurs only for classes containing attributes referencing classes that haven't been processed by the plugin yet. See the attached test project (hbm-enhance-test) to reproduce this issue. Here is an extract of the Maven log showing the issue: [INFO] Started enhance plugin..... [INFO] Processing Composite class file [hbm.test.Address]. [ERROR] Unable to enhance class [hbm.test.Address] org.hibernate.bytecode.enhance.EnhancementException: Unable to enhance persistent attribute [hbm.test.Address:country] at org.hibernate.bytecode.enhance.spi.Enhancer.enhancePersistentAttribute(Enhancer.java:367) ... (skipped) Caused by: javassist.NotFoundException: hbm.test.Country at javassist.ClassPool.get(ClassPool.java:450) at javassist.bytecode.Descriptor.toCtClass(Descriptor.java:592) at javassist.bytecode.Descriptor.toCtClass(Descriptor.java:542) at javassist.CtField.getType(CtField.java:371) at org.hibernate.bytecode.enhance.spi.Enhancer.resolveAttributeTypeDescriptor(Enhancer.java:1103) at org.hibernate.bytecode.enhance.spi.Enhancer.enhancePersistentAttribute(Enhancer.java:358) ... 28 more [INFO] Processing Entity class file [hbm.test.Country]. [INFO] Processing Entity class file [hbm.test.Director]. ... Note that the build doesn't fail, even though those classes are not enhanced. On Windows, version 4.3.8 of the plugin is also affected by issue HHH-9581, which will interfer while testing this issue.
    via by Johnny Macchione,
    • org.hibernate.bytecode.enhance.EnhancementException: Unable to enhance persistent attribute [hbm.test.Address:country] at org.hibernate.bytecode.enhance.spi.Enhancer.enhancePersistentAttribute(Enhancer.java:367)
    No Bugmate found.