2 Replies Latest reply on May 4, 2009 8:08 AM by Hugo Pacheco

    join table class in hibernate

    Hugo Pacheco Newbie

      Hi all,

      First of all, I don't kow if I am posting this question in the right forum, since the "old" hibernate forums (forum.hibernate.org) now redirect to the JBoss page and could find no trace of them.

      I have two tables in my database schema

      clients: clientid*, name
      products: productid*, name

      I want Hibernate to map it these to 3 POJOs:

      class Client { int id, Name name}
      class Product {int id, Name name}
      class Name { String name }

      Mapping the first two is simple, but is there a way to tell Hibernate that Name instances correspond to a join of the names from the two tables?
      What I would like is to be able to query all the Name instances in the database (and if removed one name, remove its entrances in both tables) without an explicit query.

      Thanks in advance,
      hugo