3 Replies Latest reply on May 5, 2005 5:00 PM by Jeff Schnitzer

    Modeling "relationship attributes" with EJB3 entities

    Jeff Schnitzer Newbie

      How can relationship attributes be modeled with EJB3 entities? A simple example is a database that stores movie ratings.

      The main entities are Person and Movie. Each person can rate a movie.

      In the database, you would naturally have a Rating table that has columns {person_id, movie_id, rating}. This suggests an EJB3 entity Rating with a composite primary key of {Person, Movie} and a single field, the rating value.

      I've tried this, but it doesn't seem to work (an exception when hibernate is processing the annotations). Is this a bug? Or is there a better way of modeling this scenario? It seems like it should be pretty common.

      I'm running jboss-head.

      Thanks,
      Jeff