• Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting collections in 1:N relations

 
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!