3 Replies Latest reply on Jun 19, 2012 6:10 AM by Rajin Das

    org.hibernate.MappingException: Unable to read the mapped by attribute for ...

    florin13 Newbie

      I'm having a many-to-many relationship between Person and Match. Here are the annotations:

       

      In Person:

      @ManyToMany(cascade = {CascadeType.ALL}, mappedBy = "people", targetEntity = Match.class)
      private Set<Match> matches;

       

      In Match:

      @ManyToMany(targetEntity = Person.class, cascade = CascadeType.ALL)
          @JoinTable(
                  name = "People_Match_Person",
                  joinColumns = @JoinColumn(name = "People_Match_Id"),
                  inverseJoinColumns = @JoinColumn(name = "Person_Id")
          )
      private Set<Person> people;

       

      When I'm auditing the Person class I get the following error:

      org.hibernate.MappingException: Unable to read the mapped by attribute for people in com.example.Person!

      Without envers everything works fine...