title: Specifying table and field names for join tables in Spring Boot/Hibernate/JPA
body: <p>I am using Spring Boot/JPA backed by MySQL. I already have the DB provisioned and so plan on using <code>hibernate.hbm2ddl.auto = validate</code> (so Hibernate doesn't try to create a DB for me, it instead uses the one I supply and "validates" it against the entities I define in the code).</p>
  
  <p>I have several many-to-many relationships with my entities, such as <code>Book</code> and <code>Author</code>:</p>
  
  <pre><code>// Groovy pseudo code! One book can have multiple authors, and a
  // single author can have written many books.
  @Entity
  class Book {
      @Id
      @GeneratedValue(strategy=GenerationType.IDENTITY)
      Long id
  
      @Column(name="title")
      String title
  
      @ManyToMany
      List&lt;Author&gt; authors
  }
  
  @Entity
  class Author {
      @Id
      @GeneratedValue(strategy=GenerationType.IDENTITY)
      Long id
  
      @Column(name="name")
      String name
  
      @ManyToMany
      List&lt;Book&gt; books
  }
  </code></pre>
  
  <p>Here, those classes are represented by the following tables:</p>
  
  <pre><code>[books]
  id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT # PRIMARY KEY
  title VARCHAR(50) NOT NULL
  
  [authors]
  id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT # PRIMARY KEY
  name VARCHAR(100) NOT NULL
  
  [books_x_authors]
  books_x_authors_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT # PRIMARY KEY
  book_id    # FK on books
  author_id  # FK on authors
  </code></pre>
  
  <p>Where <code>books_x_authors</code> is my many-to-many or "crosswalk" table. Thats a DB naming convention I really like and want to stick with if at all possible. So how do I configure Spring Boot/Hibernate to use <code>books_x_authors</code> as my join/crosswalk table instead of expecting perhaps a table adhering to its own conventions?</p>