This content has been marked as final.
Show 2 replies
-
1. Re: Master-Detail Relationships - Foreign key not updated
fabboco Jun 20, 2005 6:27 AM (in response to epbernard)Dear Emmanuel,
thank you for your answer.
Since the EJB3 container is not responsible of relationships management, the only reason for which I define the relationship (using @OneToMany and @ManyToOne) is to have foreign key created.
Is it correct ?
Paragraph 2.1.7 of specification terminates:
The container handles the object-relational mapping of the relationships, including their loading and
storing to the database as specified in the metadata of the bean class, and the referential integrity of the
relationships as specified in the database (e.g., by foreign key constraints).
Shouldn't it mean that the container have to manage the relationships ?
EJB3 looks like a step forward in semplification of enterprise application, but the price to pay seams very high !
Can you help me to clearify the situation ?
Thank You.
Fabrizio -
2. Re: Master-Detail Relationships - Foreign key not updated
epbernard Jun 20, 2005 6:49 AM (in response to epbernard)Nan, EJB3 is not that dumb ;-)
When you define a *bidirectional* relationship, you have to define the owner side. When the assoc is updated on this side, the association is updated in DB, when the assoc is updated on the other side, then no action is done on the DB.
mappedBy means the other side owns it.