title: Explicitly changing the name of a column with Hibernate
body: <p>How can you rename a field name in a table which generates Hibernate?
  When you create:</p>
  
  <pre><code>@ManyToMany(targetEntity = GroupRightEntity.class)
  or
  @ManyToMany(targetEntity = UserRightEntity.class)
  </code></pre>
  
  <p>Now made with an explicit change of names of columns in the Database.</p>
  
  <pre><code>alter table security_mapping_user rename column sec_mapping_id to secmappingentity_id;
  </code></pre>
  
  <p>Thank you for your help and understanding.</p>
  
  <hr>
  
  <p>Hibernate generates links for additional tables. Accordingly, I understand that the generated field names. I need to use annotations, or something else, these column names change. I hope I wrote everything correctly.</p>
  
  <hr>
  
  <p>We have.</p>
  
  <pre><code>@Entity
  @Table(name = "ROLE")
  public class RoleEntity implements Role, Serializable {
      private static final long serialVersionUID = 1L;
  
      @Id
      @GeneratedValue(generator = "SEQ_ROLE")
      @SequenceGenerator(name = "SEQ_ROLE", sequenceName="SEQ_ROLE", allocationSize = 1)
      private Long id;
      private String name;
      private String description;
  
  @Entity
  @Table(name = "URL")
  public class UrlEntity implements Url, Serializable {
      private static final long serialVersionUID = 1L;
  
      @Id
      @GeneratedValue(generator = "SEQ_URL")
      @SequenceGenerator(name="SEQ_URL", sequenceName="SEQ_URL", allocationSize = 1)
      private Long id;
      private String url;
      @OneToMany(targetEntity = RoleEntity.class, fetch = FetchType.EAGER, mappedBy="url_id")
      private Set&lt;Role&gt; roles;
  </code></pre>
  
  <p>Later we get a third table. "URL_ROLE"</p>
  
  <p>In this table, the fields are named.
  "URL_ID" and "ROLE_ID" </p>
  
  <p>"URL_ID" need to rename the field in the "urlentity_id".</p>
  
  <p>It seems now I built everything correctly.</p>