org.hibernate.AnnotationException: Unable to create unique key constraint ("ORDER") on table TestEntity: database column 'ORDER' not found. Make sure that you use the correct column name which depends on the naming strategy in use (it may not be the same as the property name in the entity, especially for relational types)

Hibernate JIRA | Nigel Sim | 8 months ago
  1. 0

    When using JPA2 style column name quoting column names in @UniqueContraints are not normalised. The attached entity will not load with Hibernate, raising the following exception: org.hibernate.AnnotationException: Unable to create unique key constraint ("ORDER") on table TestEntity: database column 'ORDER' not found. Make sure that you use the correct column name which depends on the naming strategy in use (it may not be the same as the property name in the entity, especially for relational types) at org.hibernate.cfg.Configuration.buildUniqueKeyFromColumnNames(Configuration.java:1684) at org.hibernate.cfg.Configuration.buildUniqueKeyFromColumnNames(Configuration.java:1616) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1452) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1846) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:857) ... 30 more Using the Hibernate style backticks in the @UniqueContraint resolves this, but JPA2 compliance requires that double quotes should also work. A complete test case is also attached, from which that file comes.

    Hibernate JIRA | 8 months ago | Nigel Sim
    org.hibernate.AnnotationException: Unable to create unique key constraint ("ORDER") on table TestEntity: database column 'ORDER' not found. Make sure that you use the correct column name which depends on the naming strategy in use (it may not be the same as the property name in the entity, especially for relational types)
  2. 0

    When using JPA2 style column name quoting column names in @UniqueContraints are not normalised. The attached entity will not load with Hibernate, raising the following exception: org.hibernate.AnnotationException: Unable to create unique key constraint ("ORDER") on table TestEntity: database column 'ORDER' not found. Make sure that you use the correct column name which depends on the naming strategy in use (it may not be the same as the property name in the entity, especially for relational types) at org.hibernate.cfg.Configuration.buildUniqueKeyFromColumnNames(Configuration.java:1684) at org.hibernate.cfg.Configuration.buildUniqueKeyFromColumnNames(Configuration.java:1616) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1452) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1846) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:857) ... 30 more Using the Hibernate style backticks in the @UniqueContraint resolves this, but JPA2 compliance requires that double quotes should also work. A complete test case is also attached, from which that file comes.

    Hibernate JIRA | 8 months ago | Nigel Sim
    org.hibernate.AnnotationException: Unable to create unique key constraint ("ORDER") on table TestEntity: database column 'ORDER' not found. Make sure that you use the correct column name which depends on the naming strategy in use (it may not be the same as the property name in the entity, especially for relational types)
  3. 0

    JPA @UniqueConstraint doesn't see the columns

    Stack Overflow | 1 year ago | mat_boy
    org.hibernate.AnnotationException: Unable to create unique key constraint (task, date_at) on table task: database column 'task' not found. Make sure that you use the correct column name which depends on the naming strategy in use (it may not be the same as the property name in the entity, especially for relational types)
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    WildFly8 JPA2.1 and Enumerated values

    Stack Overflow | 3 years ago | drodil
    org.hibernate.AnnotationException: Attribute [com.project.ejb.model.Zoo.animals] was annotated as enumerated, but its java type is not an enum [java.lang.String]
  6. 0

    Hibernate JPA how to convert list-index hbm attribute to annotations?

    Stack Overflow | 2 years ago | Moussi
    org.hibernate.AnnotationException: Unable to create unique key constraint (TYPE_COMPARUTION_COURRIER_TYPES_COURRIERS_IDX) on table TYPES_COMPARUTIONS2TYPES_COURRIERS: database column 'TYPE_COMPARUTION_COURRIER_TYPES_COURRIERS_IDX' not found. Make sure that you use the correct column name which depends on the naming strategy in use (it may not be the same as the property name in the entity, especially for relational types)

  1. tjago 4 times, last 8 months ago
  2. davidvanlaatum 2 times, last 1 month ago
  3. r1chjames 1 times, last 6 months ago
  4. Kawada 108 times, last 7 months ago
43 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.AnnotationException

    Unable to create unique key constraint ("ORDER") on table TestEntity: database column 'ORDER' not found. Make sure that you use the correct column name which depends on the naming strategy in use (it may not be the same as the property name in the entity, especially for relational types)

    at org.hibernate.cfg.Configuration.buildUniqueKeyFromColumnNames()
  2. Hibernate
    Configuration.buildSessionFactory
    1. org.hibernate.cfg.Configuration.buildUniqueKeyFromColumnNames(Configuration.java:1684)
    2. org.hibernate.cfg.Configuration.buildUniqueKeyFromColumnNames(Configuration.java:1616)
    3. org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1452)
    4. org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1846)
    4 frames
  3. org.hibernate.jpa
    EntityManagerFactoryBuilderImpl$4.perform
    1. org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:857)
    1 frame