There is a dynamic-ql for this.

In the bean:
public abstract Collection ejbSelectMyDynamicQuery(String ejbQl,Object[] args)
throws FinderException;

Where ejbQl is EJBQL/JBossQL query, args - array of parameters.

In jbosscmp-jdbc.xml:
         <query>
            <query-method>
               <method-name>ejbSelectMyDynamicQuery</method-name>
               <method-params>
                  <method-param>java.lang.String</method-param>
                  <method-param>java.lang.Object[]</method-param>
               </method-params>
            </query-method>
            <dynamic-ql/>
         </query>

This is covered in for-pay docs.

alex
         
Friday, January 17, 2003, 2:27:02 PM, you wrote:

JC> Hi,

JC> I have web-app being built to run within a jboss304+tomcat406 environment.

JC> I have a session facade whose responsibilty it is, amongst others, to 
JC> take a searchCriteriaVO (value object) and use it to select a particular 
JC> finder.

JC> Now, I know that one could take those criteria and take every possible 
JC> combination of criteria and apply it to a single finder - one finder per 
JC> unique combination of criteria but, to me this seems like a lot of hard 
JC> work.

JC> It looks as though one could write code to dynamically construct an sql 
JC> statement  which would be quicker and easier than constructing code to 
JC> select a finder but I'm thinking maybe there's a way using ejb-ql to do 
JC> this stuff more dynamically.

JC> Here's an example scenario.

JC> I am searching for cars:

JC> searchCriteriaVO has
JC>     engineType (all,1, 2 ,3)
JC>     condition (any,good, fair, poor)
JC>     registrationFromDate (could be null)
JC>     registrationToDate(could be null)

JC> The above criteria could produce a fairly large number of unique 
JC> combinations and thus that same number of finders.

JC> Whats the best or easiest way to code this? Is there a 'best practice' 
JC> which I need to know about?
JC> (I have a cars entity bean and a cars session facade)

JC> thanks
JC> jim




-------------------------------------------------------
This SF.NET email is sponsored by: Thawte.com
Understand how to protect your customers personal information by implementing
SSL on your Apache Web Server. Click here to get our FREE Thawte Apache 
Guide: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0029en
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to