Uploaded image for project: 'Hibernate ORM'
  1. HHH-10396

In a @OneToMany association with @JoinColum the @ForeignKey is not taken into consideration when generating the association database schema

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.6
    • Fix Version/s: 5.0.7
    • Component/s: hibernate-core
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      Description

      When declaring the mapping:

      
      @Entity
      @Table(name = "USERS")
      public class User {
      	@Id
      	@GeneratedValue
      	@Column(name = "USER_ID")
      	private long id;
      
      	@OneToMany(targetEntity = Group.class)
      	@JoinColumn(name = "USER_ID", foreignKey = @ForeignKey(name = "FK_USER_GROUP"))
      	private List<Group> groups;
      }
      
      @Entity
      @Table(name = "GROUP")
      public class Group implements Serializable {
      	@Id
      	@Column(name = "GROUP_ID")
      	private Long id;
      }
      

      the @Foreignkey is not considered

        Attachments

          Activity

            People

            • Assignee:
              dreab8 Andrea Boriero
              Reporter:
              dreab8 Andrea Boriero
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: