The JDBC control can not be invoked from a pojo, you can however test
your jdbc controls using JUnit in a standalone environment.  See
http://beehive.apache.org/docs/1.0.2/controls/testing.html for a
detailed description of how to do that.

- Chad

On 2/22/07, Wendy <[EMAIL PROTECTED]> wrote:

Thank you very much, this really helps me.
I have another question: can jdbc control be invoked in a plain old java
class? if yes, how can I initialize the jdbc control? I tried to use
@Control annotation, but it throws a NullPointerException.


Chad Schoettger-2 wrote:
>
> Hello,
>
> Hope this helps,
>   - Chad
>
>
> On 2/21/07, Wendy <[EMAIL PROTECTED]> wrote:
>>
>> Hi, I'm a new user for Jdbc control. I have some questions about it and
>> hope
>> to get advices from jdbc control experts.
>> 1. there's a method findCustomeByName, the logic is if only firstname
>> passed
>> in, then search by firstname, if only lastname passed in, then search by
>> lastname, if both are passed in, then search by firstname and last name.
>> How
>> can I implement this functionality in jdbc control with a method define
>> as
>> findCustomerByName(String firstname, String lastname)?
>
> If you want this kind of logic you have a number of options:
> 1) Create a stored procedure which encapsulates the logic and
>    invoke the stored procedure from your JDBC control method.
> 2) Create three JDBC control methods (one for each case) and
>    invoke the proper one based on logic in the page flow controller
>    or a custom control.
> 3) In the SQL annotation for the JDBC control method, use the {sql:} form
>    of substitution and pass in the necessary SQL fragment to find the
>    customer.
>
> If you haven't already, you may want to take a look at the JDBC
> Control Developer guide, it can be found at:
>
> http://beehive.apache.org/docs/1.0.2/system-controls/jdbc/guide.html
>
>
>> 2. when are onAcquire() and onRelease() methods in jdbc control exactly
>> invoked? If I have a page flow using a jdbc control,when the jdbc
>> connection
>> is established and when it is closed?
> From a page flow control resources are scoped to the HttpRequest.
> onAcquire will be invoked the first time in a request that a control
> method is invoked.  Once the Request has completed the onRelease()
> method is invoked.  So for each request which uses the JDBC control, a
> connection will be established and released.  There is a new JDBC
> control API which can be used to tune this behavior, setConnection(),
> however; it is not in Beehive 1.0.2, but will be included in a future
> release.
>
>> 3. Is it possible to use jdbc control in an EJB, i.e. stateless session
>> bean?  If yes, how can I do it? Please give me some code examples.
> This currently is not supported.
>
>>
>> Thank you very much.
>>
>> --
>> View this message in context:
>> http://www.nabble.com/JDBC-control-questions-tf3270091.html#a9091777
>> Sent from the Beehive - Dev mailing list archive at Nabble.com.
>>
>>
>
>

--
View this message in context: 
http://www.nabble.com/JDBC-control-questions-tf3270091.html#a9107048
Sent from the Beehive - Dev mailing list archive at Nabble.com.


Reply via email to