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

ejbSelect

 
Ranch Hand
Posts: 271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Page 401 HF EJB ,says

Select methods are here simply to make your life
easier, by letting the Container build the real database
access code from you queries.
So the process is usually something like:
1.Write a home business method
2.Implement the home business method to call
the ejbSelect method that does the real data access.

3. Declare the abstract select method in your bean
class

1. Write the EJB-QL for the select



How does the Container know how to implement the code for the ejbSelect method.How does one bind the ejbSelect method to the EJB-QL in the DD?
 
jeff mutonho
Ranch Hand
Posts: 271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Last step was meant to be :
4. Write the EJB-QL for the select
 
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found this in my project ejb-jar.xml inside the <entity> element after defining all the cmp-field elements

<query>
<query-method>
<method-name>findAllExpiredRequests</method-name>
<method-params>
<method-param>java.sql.Timestamp</method-param>
</method-params>
</query-method>

<ejb-ql><![CDATA[SELECT OBJECT(r) FROM RequestManager AS r WHERE r.requestCreateTime < ?1]]></ejb-ql>
</query>

I am also surprised that this tag is not mentioned in HFEJB
 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ref Section 22.5 Deployment descriptor DTD of EJB Spec

<!--
The ejb-ql element contains the EJB QL query string that defines a
finder or select query. This element is defined within the scope of a
query element whose contents specify the finder or the select method
that uses the query. The content must be a valid EJB QL query string
for the entity bean for which the query is specified.
The ejb-ql element must be specified for all queries that are expressible
in EJB QL. -->

Example:
<query>
<query-method>
<method-name>ejbSelectPendingLineitems</method-name>
<method-params/>
</query-method>
<ejb-ql>SELECT OBJECT(l) FROM LineItems l WHERE l.shipped <> TRUE </ejb-ql>
</query>

This is how the mapping is provided in the DD.
 
reply
    Bookmark Topic Watch Topic
  • New Topic