You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by "Sandeep S. Chhikara" <sc...@inventes.com> on 2004/06/08 00:32:34 UTC

inconsistant save MSSQL

Hi all, 

I am experiencing inconsistant results with save() method,  call to save() does not save results sometimes. 
This failure is inconsistant and has been observed multiple times a day. Lets say typically of 2000 rows data will be save correctly and 
for 1 or 2 or more it might not be saved. 

Environment: Web application on TOMCAT, 
torque 3.1 
database: MSSQL

Table schema is simple, each table/Tables have ID columns as primary keys. All tables have similiar structure and only problem in in one of tables. 
The web application has multiple threads (created by developers) , and all api's callling  Torque save() have been synchronized. 

This failure to save occurs inconsistantly in some rows while for most it works.

Please suggest solution. 

thanks in advance
Sandeep

--------------------code snippet 
    Criteria crit = new Criteria();    
    crit.add(TransformJobPeer.TRANSFORM_JOB_ID,tji.getTranformJobId().longValue());
    List v = TransformJobPeer.doSelect(crit);  
    Iterator itr = v.iterator();
     TransformJob lkup;
    BigInteger jobId = tji.getTranformJobId();
      
      Iterator lItr;
      TransformJobFilesInterface tjfi;
  
    while(itr.hasNext()){
     lkup = (TransformJob)itr.next();
     try{
      logger.error("TESTING : data from Db ID:" + tji.getTranformJobId() + ".STATUS:" + tji.getStatus());       
       lkup.setDateLastUpdated(new Date());     
       lkup.setStatus(tji.getStatus());
       lkup.setIsComplete(true);

       logText = lkup.getLogText();
       
       if(null == logText)
        logText = tji.getLogText();
       else
        logText= logText + tji.getLogText();
       lkup.setLogText(logText);
       
       lkup.save();
    }catch....
----------------------------------------





table schema:
 <table name="TRANFORM_JOB" 
        idMethod="native">
       <column name="JOB_ID"
         required="true"
         primaryKey="true"
         type="BIGINT"
         identity="true"
         autoIncrement="true"
         javaType="Object"
         description="job table"/>
         <column
               name="NUM_FILES"            
               type="INTEGER"            
         description="number of files"/>          
         <column
        name="NUM_TRIES"            
        type="INTEGER"            
        javaName="numberTry"
         description="number of tries done"/>
         <column
               name="isJobComplete"            
               type="BIT"            
               javaName="isComplete"
         description="isJobComplete"/>           
       <column
         name="BATCH_DATE"            
         type="CHAR" 
         size="8"
         javaName="batchDate"
         description="date in format yyyymmdd"/>
          <column
   name="DEST_DIR_PATH"
   type="VARCHAR"
   size="512"
   javaName="destDirPath"
         description="dest path"/>   
         <column
     name="errorReason"
     type="CHAR"
     size="25"
     javaName="errorReason"
  description="errorReason"/>  
        <column
          name="LOG_TEXT"
          type="LONGVARCHAR" 
          javaName="logText"
         description="log "/>
           <column
                name="DATE_FILED"            
                type="DATE"             
                javaName="dateFiled"
                description="time stamp"/>                      
              <column
                name="DATE_RECEIVED"            
                type="DATE"             
                javaName="dateReceived"
           description="time stamp"/>                 
        <column
               name="DATE_CREATED"            
               type="DATE"             
               javaName="dateCreated"
         description="time stamp"/>   
<some foreign key defs> 
</table>