Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Retrieving an entity bean  RSS feed

 
neva elsaeed
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

This might sound like a trivial question but I seem a bit lost..
To clarify the question I am going to give an exmaple:

say I have a one-to-many relationship between 2 entity beans: membership and member. A membership may have many members but a member belongs to only one membership.

say I look for a membership in the db using findByPrimaryKey. Everytime a call like that is made, select statements that go to the db don't just find the membership, but all members inside it as well. I don't think that this is efficient. Say for example I want to show, in a page, all memberships without displaying any members, I will only need to get the membership beans and no the members as well. A query to retrieve all memberships will take alot of time due to the fact that it will select all members of each membership as well even though I don't really need it!
Can anyone give me a suggestion on how to bypass that problem?
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That functionality would be part of your server vendor's stuff. Lazy stuff is good, but it's not part of the EJB spec. Check out your server documentation. If you have a remotely respectable one, I'm sure it does it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!