ejbSelect methods are Business helper methods. so they are declared in the bean class.they aid to find entities based on some criteria.as they are not fixed to an entity..they may return collection also cmp field can be returned by them. as they only need use in bean class..also they need to look database..you have ejbql to implement them in an easier way.(which compiles to sql underneath) so you declare them abstract in bean class.(container implements them)
ejbFinder methods are just finders. you(clients) use them to find entities in the database. so they have to be declared in the home interface(clients need to see) as usual as its based on database data..you use ejbql so container implements them.
hope this helps you. [ August 28, 2006: Message edited by: cheenu Dev ]
Simply put, Both ejbSelect and ejbFinder methods allow you to query the database via EJB-QL. ejbSelect will be used internally (by the bean class) and will NOT be allowed to be invoked by the client. Whereas the ejbFinder methods are allowed to be invoked by the client (and hence are declared in the home interface).
For example, if you have exposed the following methods to the user:
findSouthAustralianUsers() and findVictorianUsers()
interally these finder methods can refer to a ejb select method findUsersByState()
One more difference is that ejbFinder methods can only return the component interface or a collection of the component interface (either java.util.Collection or java.util.Set)
wheras ejbSelect methods can return an Object as well (someone please confirm this).
MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
1) ejbFind methods are exposed to client through home interface. ejbSelect methods cannot be exposed. i.e ejbSelect method can be used internally by the EJB's business methods.
2) ejbFind can only return reference to Component Interface (Single Entity Finder) or Collection of references to Component Interface (Multiple Entity Finder ) ejb Select method can return any RMI-IIOP compliant value in addition to above.
3) ejbFind methods are always executed by a bean in pooled state while an ejbSelect method can be executed by a bean in pooled state(through ejbHome business methods) as well as in ready state( through Business methods ).
4) (w.r.t CMP Entity Bean) ejbFind methods need not be implemented by the Bean Provider in bean code. However Bean Provider has to provide an abstract definition of ejbSelect in the bean code.
SCJP 1.4 : 91%
SCWCD 1.4 : 95%
SCBCD 1.3 : 95%
SCJP 6 Upgrade : 95%
Next SCBCD 1.5
Man is not finished when he is defeated. He is finished when he quits.
I've got no option but to sell you all for scientific experiments. Or a tiny ad: