title: Why Spring Boot/JPA creates constraints names like this fkm5pcdf557o18ra19dajf7u26a?
body: <p>I have an entity called City:</p>
  
  <pre><code>@Entity
  @Table (name = "cities")
  public class City implements Serializable {
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      @Column(updatable = false, nullable = false, columnDefinition = "serial")
      private Long id;
  
      @Column(nullable = false)
      private String name;    
  
      @ManyToOne(fetch = FetchType.LAZY)
      @JoinColumn(nullable = false)
      private Department department;
  
      @Column(nullable = true)
      private Integer code;
  }
  </code></pre>
  
  <p>In this case if I not specify a name for the field Department it creates a field called department_id in my table "cities", that's Ok but when I see the Constraints created appears a constraint with name fkcl2xocc3mnys8b84bw2dog35e. Why this name? Does it make any sense?</p>
  
  <p><a href="https://i.stack.imgur.com/0ySl5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0ySl5.png" alt="enter image description here"></a></p>
  
  <p>This is my yaml jpa configuration:</p>
  
  <pre><code>spring:
      profiles: development
      datasource: 
          url: jdbc:postgresql://localhost:5432/lalala
          username: postgres
          password: postgres
          sql-script-encoding: UTF-8
          driver-class-name: org.postgresql.Driver
      data.jpa.repositories.enabled: true
      jpa:
          generate-ddl: true
          hibernate:
              ddl-auto: update
              show_sql: true
              use_sql_comments: true
              format_sql: true
              type: trace
              jdbc.lob.non_contextual_creation: true
              naming:
                  physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
          properties:
              hibernate:
                  jdbc.lob.non_contextual_creation: true
                  dialect: org.hibernate.dialect.PostgreSQLDialect
  </code></pre>