0 Replies Latest reply on Sep 14, 2006 4:03 AM by yehuda rajuan

    JoinColumn annotation order

    yehuda rajuan Newbie

      Hi all :)
      I have been using ManyToMany annotation to connect two tables.

      I thought the order of 'JoinColumn', does not matter, however when I wrote:

      @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE}, fetch=FetchType.LAZY)
      @JoinTable(name="profile_group_link"
      , inverseJoinColumns = {@JoinColumn(name = "group_id")},
      joinColumns = { @JoinColumn(name = "profile_id"),@JoinColumn(name = "population_id")})

      It did not work ,so I changed the order:
      joinColumns = {@JoinColumn(name = "population_id"), @JoinColumn(name = "profile_id")})

      and it worked perfect!!!

      Does any one knows why that happens?

      Do the order of the annotation change things?

      thanks
      Very confused individual