This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting collections in 1:N relations  RSS feed

 
Leandro Melo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, everytime i got a 1:N relation and suppose a direction from 1 to N,
i'll get such a method:

public Collection getEmployees();

in a CompanyBean for example.

Any time i need to add one elemento to the employees collection i need to first retrieve the collection, add one more element, re-set the collection.

Is there another way to do that? What is overhead on this approach?
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry -- that's what the spec says you have to do. On the upside, your EJB container probably does lazy loading of all those members, so it's not like it's really loading all of them anyways. (Hopefully).
 
Leandro Melo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!