thanks chad....
Chad Schoettger-2 wrote:
>
> Hi Sahuly,
>
> I'll try to answer your question about transactions and the JDBC control.
>
> In the code you posted, the JDBC control will acquire a connection the
> first time it is used in a page flow action. So in the case of the
> addUserInfo() action, the following line will cause the control to
> acquire a JDBC connection:
>
> userControl.addUserInfo(userDTO.getUserName(),userDTO.getAge());
>
> The JDBC control will hold the connection until the addUserInfo()
> action is no longer on the call stack, then the connection will be
> released.
>
> If you want to wrap the connection in a transaction, you can use the
> JDBC system control's getConnection() API. You could make this the
> first line of your addUserInfo() action:
>
> java.sql.Connection conn = userControl.getConnection();
>
>
> Once you have the connection you can then use JTA to start a
> transaction and either commit or roll it back after you have completed
> the work for the transaction.
>
> If you are not getting forwarded from this action there must be an
> exception during the call to the JDBC control. Have you seen anything
> in your server logs?
>
> - Chad
>
>
>
>
>
>
>
>
>
>
> On 1/17/07, sahuly <[EMAIL PROTECTED]> wrote:
>>
>> hai,
>>
>> I am telling my problem in the below program in the bold
>> letters
>> please some one tell me a solution for this....
>>
>> Controller class:-----------------------
>>
>> @Jpf.Controller (
>>
>> simpleActions = {
>> @Jpf.SimpleAction(name = "begin", path =
>> "/com/ofs/jdbccontrol/beehive/pageflow/index.jsp")
>> },
>> sharedFlowRefs = {
>> @Jpf.SharedFlowRef(name = "shared" , type =
>> com.ofs.jdbccontrol.beehive.sharedflow.SharedFlow.class)
>> }
>> )
>> public class Controller
>> extends PageFlowController {
>>
>> @Control()
>> private UserBOControl userControl;
>> public UserDTO[] getUser;
>>
>>
>> @Jpf.Action (
>> forwards = {
>> @Jpf.Forward(name = "success", path = "index.jsp"),
>> @Jpf.Forward(name = "failure", path =
>> "/com/ofs/jdbccontrol/beehive/pageflow/error.jsp")
>> }
>> )
>>
>> public Forward addUserInfo(UserDTO userDTO) {
>>
>> try {
>> userControl.addUserInfo(userDTO.getUserName(),
>> userDTO.getAge());
>> ------> This statement is not executed i.e control is not returned back
>> to
>> here ...my webpage idle but data is
>> getting inserted into the DB...
>> ------> at the same time i dont know whether connection is released or
>> not
>> and also
>> don't know where to maintain the transaction and
>> how??????????????
>> return new Forward("success");
>> } catch (Exception e) {
>> e.printStackTrace(System.err);
>> }
>> return new Forward("success");
>> }
>>
>> @Jpf.Action (
>> forwards = {
>> @Jpf.Forward(name = "success", path =
>> "/com/ofs/jdbccontrol/beehive/pageflow/listUser.jsp"),
>> @Jpf.Forward(name = "failure", path =
>> "/com/ofs/jdbccontrol/beehive/pageflow/error.jsp")
>> }
>> )
>> public Forward getUserInfo() {
>>
>> Forward fwd = new Forward("success");
>> try {
>>
>> getUser = userControl.getUserInfo("sachin");
>> fwd.addActionOutput("list", getUser);
>> } catch (Exception e) {
>> e.printStackTrace(System.err);
>> return new Forward("failure");
>> }
>> return fwd;
>> }
>> }
>>
>>
>> UserBOControl class :----------
>>
>> @org.apache.beehive.controls.api.bean.ControlExtension
>> @JdbcControl.ConnectionDriver(
>> databaseDriverClass = "oracle.jdbc.driver.OracleDriver",
>> databaseURL = "jdbc:oracle:thin:@192.54.45.251:1521:ORCL",
>> userName = "t01",
>> password = "t012006"
>> )
>>
>> public interface UserBOControl
>> extends JdbcControl {
>>
>> @JdbcControl.SQL(statement = "INSERT into useraccess
>> values({userName},
>> {age})")
>> public void addUserInfo(String userName, int age)
>> throws SQLException;
>>
>> @JdbcControl.SQL(statement = "SELECT * FROM userinfo WHERE userName =
>> {name}")
>> public UserDTO[] getUserInfo(String name)
>> throws SQLException;
>> }
>>
>> thanks in advance
>>
>> Regards,
>> sahuly
>>
>> --
>> View this message in context:
>> http://www.nabble.com/JDBC-Control-tf3025805.html#a8406106
>> Sent from the Beehive - User mailing list archive at Nabble.com.
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/JDBC-Control-tf3025805.html#a8425668
Sent from the Beehive - User mailing list archive at Nabble.com.