my dog learned polymorphism
The moose likes EJB and other Java EE Technologies and the fly likes @JoinTable or  @JoinCol... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "@JoinTable or  @JoinCol..." Watch "@JoinTable or  @JoinCol..." New topic

@JoinTable or @JoinCol...

Dupon David

Joined: Aug 11, 2006
Posts: 19
as I still did not solve my problem, I will try to reformulate my question I want to make request EJB3 QL with joint.
here my tables:

Knowing that I have the following table which has like cl�s primary both cl�s primary of the tables the preceding one.

knowing that cardinality between these tables and ManyToMany, my question and to know if so that I can make a join

between my tables I must create tables interm�diates which contain that the primary keys like umlssnmi_wasnmi kind

and whoart_wasnmi for example, and to make @JoinTable; or the table "wasnmi" will join the tables.

I thank you in advance
Mike Keith
Ranch Hand

Joined: Jul 14, 2005
Posts: 304

A JPA provider would use the join table and automatically join across the many-to-many relationship between the two entity tables, but there is no support (in Java!) for putting state on relationships. If you have state (more than just foreign keys) in your join table then you need to model it using a relationship entity that is related in a many-to-one to each of the two entities and make the two entities have a one-to-many back to the relationship entity.

Hope this helps,

Pro JPA 2: Mastering the Java Persistence API
Dupon David

Joined: Aug 11, 2006
Posts: 19
Hello Mr Mike Keith.
Initially I thank you for your book Pro EJB3, it is very interesting (it is also the opinion of my colleagues).
I also thank you for your answer which I tried to implement as follows:

For table WHOART:
For UMLSSNMI table:

The TermProjPK class which contains the primary keys of table WASNMI:

For WASNMI table:

That does not function, because I do not know how I can reach the fields ` MODIF' and ` SRC' of the table ` WASNMI' starting from TermSource object.

Somebody already made there?. Any suggestion will be come well it.
I agree. Here's the link:
subject: @JoinTable or @JoinCol...
It's not a secret anymore!