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. |