Helo, I have two entities with the following mappings
When this method completes Q1 and A1 are persistes but the foreign key IS NULL but for A2 and Q2 the foreign key is INSERTED WITH THE CORRECT VALUE.
The point is: the foreign key is filled only if the entity passed to the persit() is an "owning side" entity.
Is it not possible to use the cascade operations when persisting a entity of the "inverse side" of the relationship and have the foreign key populated? [ June 21, 2008: Message edited by: Odair Brentam ]
"Brentam", please check your private messages for an important administrative matter.
Also, please be sure to use UBB code tags when posting code to the forums. Unformatted code is extermely hard to read and many people that might be able to help you will just move along. Please read this for more information.
You can go back and change your post to add code tags by clicking the .
In JPA you must maintain bi-directional relationship in your application or object mode code. Basically you code should work if you set methods also set the inverse relationship (careful of the infinite loop).