Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Bidirectional relationships on Objects in Jpa

sridhanya ganapathy
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
In my application for a scenario inheritance is much suited design.
ie N child Objects tied to a parent object{Grouping common attributes}
As JPA doesn't support such inheritance my application expected, we where forced to use "One to Many" Bidirectional Mapping.In the same i have few questions.

class Parent{
list <Child> childObjects
class Child {
Parent parentObj;

1)Is that a bad object design ie having bidirectional relationship?

2)JPA forces the developer to take care of bidirectional relationship in the objects ..To be more clear when child is added to the persistence store forces the developer to update the parentlist also.
Is this behaviour forced by jpa?

3)Is there any other workaround for the same.
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!