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

Finder Versus Select  RSS feed

 
Kelly Walker
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone provide a quick clarification on the difference between finder and select methods and when to use one over the other. I'm using EJB2.0.
Thank you.
 
Dana Hanna
Ranch Hand
Posts: 227
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A finder method returns bean instance(s).
A select method can return a value of any type. This is must useful for aggregate functions. Example - a select method could return a float representing the average order amount for a specific day... Previously this was only possible by doing a finder, and then iterating programatically from a session bean and computing the average.
Summary - Allowing EJBQL in a select allows you to take advantage of the databases built in functionality when a bean instance isn't what you ultimately need.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!