• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

More confusion page 405

 
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On page 405, it shows a EJB-QL query for a home method. It is my understanding that queries are only defined for finder and select methods, not home methods. If this is a query for the ejbSelectGetMoviesByDirectorAndGenre() method then it is incorrect because the querty should be returning a collection of movie objects not just their titles. This is evident if you examine the ejbHomeListMoviesByDirectorAndGenre code on the bottom of page 396.
What gives?
 
Keith Rosenfield
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just noticed that it should be returning strings, so the query is correct. That still leaves the question, is the query for the home method or the select method.
Thanks
 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy --
ALL home business methods (i.e methods that are not finder methods) will be implemented via your ejbSelect methods, so the EJB-Ql that is shown for home business methods always means that it is a query for a select method. I should have shown the whole thing, complete with the select methods, but I didn't. So you'll just have to imagine the select methods that you'd use to do this. In other words, I am showing you how the home business method maps to a query, but I'm not showing the intermediate steps of the select method.
Actually, that's a good exercise for you -- figure out what the select method might look like
cheers,
Kathy
 
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for clearing that Kathy
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an additional question about page 405.

The return type of the home business method is String. What if the query were to return more than one record? How would multiple directorIDs fit into a single string?
 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jef,


The return type of the home business method is String. What if the query were to return more than one record? How would multiple directorIDs fit into a single string?



If you read page 278 of HFE, it says that the Home method can return any values as long as it is RMI-IIOP complaint. In the example that was given, the return type was string. But I assume you can even return that Collection you got from the ejbSelect method.
reply
    Bookmark Topic Watch Topic
  • New Topic