• Post Reply Bookmark Topic Watch Topic
  • New Topic

findByPrimaryKey - what happens for collection  RSS feed

 
sopal Pal
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
What would happen if the Home Methods declare the findByPrimaryKey to return a collection. At what point in time would the error be detected.
Same question - what would happen if the Bean Provider declares the
ejbFindByPrimaryKey to return a collection. When is the error detected.
Thanks for your time and help
Sumit
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ejbFindByPrimaryKey needs to return the component interface. Trying to return a Collection would result in an error when the application is deployed. It will compile just fine since ejbFindByPrimaryKey isn't part of any implemented interfaces.
As for the home method, you would implement this using a home method with a signature like homeFindByPrimaryKey. The container would treat this like any other home method, which means that you can make it return a Collection. You don't have finder methods in homes though, so any homeFindByPrimaryKey would have to delegate to some EQL finder or select method. You of course, couldn't delegate it to the regular findByPrimaryKey though since it will still return only one component interface object.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!