• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bidirectional relationships on Objects in Jpa

 
sridhanya ganapathy
Greenhorn
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.

eg
class Parent{
attributes
@OneToMany
list <Child> childObjects
}
class Child {
attributes
@ManyToOne
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic