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 | 1 year ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  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 | 1 year 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 | 1 year 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

    hibernate error when using single table inheritance

    Stack Overflow | 2 years ago | P.P├ęter
    org.hibernate.AnnotationException: Foreign key circularity dependency involving the following tables:
  6. 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]

  1. tjago 4 times, last 1 year ago
  2. batwalrus76 3 times, last 3 months ago
  3. davidvanlaatum 2 times, last 6 months ago
  4. r1chjames 1 times, last 10 months ago
  5. Kawada 108 times, last 12 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