[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - join table class in hibernate

hpacheco do-not-reply at jboss.com
Fri Apr 17 05:41:15 EDT 2009

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,

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4226130#4226130

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4226130

More information about the jboss-user mailing list