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 | 11 months ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  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 | 11 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 | 11 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

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