• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

findByPrimaryKey - what happens for collection

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
That's my roommate. He's kinda weird, but he always pays his half of the rent. And he gave me this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic