• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

performance issue in one-to-many in hibernate

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the better way to insert an object in one-to-many ?

for example, one Employee has many Task.

when we add one Task into Employee taskList, we have to load employee and its ALL task, and then save


The major performance issue is line 2. we need to load ALL task, maybe 1000, just for adding ONE task.

Do we have a better way to resolve this issue ?

Thanks.
 
tanay purwar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
simply create a new task set Its employee id and save it to database
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic