• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Regarding Ejb Select method

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

iam not having clear idea about Ejb Select method.i want to know the difference between ejbselect and ejbfinder methods.i want to know the difference programatically.
 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).

Cheers!
 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ejbSelect vs ejbFind

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.

Regards,
Amit
reply
    Bookmark Topic Watch Topic
  • New Topic