• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

More confusion page 405

 
Keith Rosenfield
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
Kathy Sierra
Cowgirl and Author
Rancher
Posts: 1589
5
  • Mark post as helpful
  • send pies
  • 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
 
Vivek Viswanathan
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for clearing that Kathy
 
Jef Kelly
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • 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?
 
Giju George
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic