ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Yee <r...@cruzio.com>
Subject Re: problem with SqlMapClientBuilder.buildSqlMapClient
Date Tue, 28 Oct 2008 13:32:33 GMT
Prasad,
You shouldn't call buildSqlMap more than once in your application. Call 
it when your application starts up and save a reference to it.

-R

You shouldn't be calling the
Prasad_Sivakumar wrote:
>
> Hi,
>
>  
>
>          While I am calling the 
> SqlMapClientBuilder.buildSqlMapClient(reader); I am getting multiple 
> response. My Ibatis build is 2.1.5 I am using weblogic Server 8.1.
>
>  
>
> In the below method SqlMapClientBuilder.buildSqlMapClient(reader); 
> give 2 responses because of which my query is running two times and 
> inserting same record 2 times. I feel the second trigger happns avfer 
> I call my insert statement.
>
>  
>
> I am new to Ibatis. Kindly advise me if there is some error in my 
> implementation.
>
>  
>
> *Code:*
>
> I have a base implementation with a method to start transaction.
>
>  
>
>         /**
>
>          * Start a transaction
>
>          *
>
>          * @throws Exception if business logic throws Exception
>
>          */
>
>         public void startTransaction() throws Exception {
>
>             // open up the SQL Map for transaction
>
>             isTxn = true;
>
>             try {
>
>                 System.out.println("test1");
>
>                 String resource = ConfigMgr.config.get(SQLMAP);
>
>                 Reader reader = Resources.getResourceAsReader(resource);
>
>                 System.out.println("test3");
>
>                 txnSqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
>
>                 System.out.println("test4");
>
>                 reader.close();
>
>                 txnSqlMap.startTransaction();
>
>                 isTxn = true;
>
>             } catch (Exception ex) {
>
>                 System.out.println("ex :: "+ex);
>
>                 logger.log(ERROR, ex);
>
>             }
>
>         }
>
>  
>
> And this is extended in my Data access Layer and called like:
>
>  
>
> startTransaction();
>
>                 intCountInserted=insert("mySqlId", myDTO);
>
>                 //
>
>  
>
> Regards,
>
> Prasad
>
>  
>
>  
>
>
> ------------------------------------------------------------------------
> DISCLAIMER:
> This email (including any attachments) is intended for the sole use of 
> the intended recipient/s and may contain material that is CONFIDENTIAL 
> AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or 
> copying or distribution or forwarding of any or all of the contents in 
> this message is STRICTLY PROHIBITED. If you are not the intended 
> recipient, please contact the sender by email and delete all copies; 
> your cooperation in this regard is appreciated.


Mime
View raw message