title: Spring boot / Hibernate problems with @UniqueConstraint
body: <p>I have Spring boot 1.4.3 + Hibernate 5.0.11 + H2 database. 
  My application startup fails when I try to use @UniqueConstraint with certain values. Here is it. Response class is marked with @UniqueConstraint with columnNames "survey" and "user"</p>
  
  <pre><code>@Entity
  @Table(name = "responses", uniqueConstraints = {@UniqueConstraint(columnNames = {"survey, user"}, name = "responses_survey_user_idx")})
  public class Response extends BaseEntity
  {
  
      @NotNull
      @ManyToOne(fetch = FetchType.EAGER, optional = false)
      @JoinColumn(name = "survey", nullable = false)
      private Survey survey;
  
      @NotNull
      @ManyToOne(fetch = FetchType.EAGER, optional = false)
      @JoinColumn(name = "user", nullable = false)
      private User user;
  
      @NotNull
      private String answers;// json serialized
  }
  </code></pre>
  
  <p>Survey class:</p>
  
  <pre><code>@Entity
  @Table(name = "surveys", uniqueConstraints = {@UniqueConstraint(columnNames = {"name"}, name = "surveys_name_idx")})
  public class Survey extends BaseEntity{
  
      @NotNull
      @SafeHtml
      @Length(min = 3)
      private String name;
  
      @NotNull
      @SafeHtml
      @Length(min = 3)
      private String description;
  
      @OneToMany(cascade = CascadeType.REMOVE, fetch = FetchType.LAZY, mappedBy = "survey")
      private List&lt;Response&gt; responses;
  }
  </code></pre>
  
  <p>User class:</p>
  
  <pre><code>@Entity
  @Table(name = "users", uniqueConstraints = {@UniqueConstraint(columnNames = "login", name = "users_unique_email_idx")})
  public class User extends BaseEntity {
  
      @NotEmpty
      @SafeHtml
      private String login;
  
      @NotEmpty
      @Length(min = 8)
      @SafeHtml
      private String password;
  
      @OneToMany(cascade = CascadeType.REMOVE, fetch = FetchType.LAZY, mappedBy = "user")
      private List&lt;Response&gt; responses;
  }
  </code></pre>
  
  <p>The error I get is:</p>
  
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: Unable to create unique key constraint (survey, user) on table responses: database column 'survey, user' 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)
  </code></pre>
  
  <p>I've tried to change names of columns in Response class, but it didn't help.
  It work only when I remove @UniqueConstraint in this class at all .</p>
  
  <p>Any ideas how to deal with this?</p>