1 21 22 package org.opensubsystems.core.persist.db; 23 24 import java.sql.Connection ; 25 import java.sql.PreparedStatement ; 26 import java.sql.SQLException ; 27 28 import org.opensubsystems.core.data.DataConstant; 29 import org.opensubsystems.core.data.ModifiableDataObject; 30 import org.opensubsystems.core.error.OSSException; 31 32 59 public class DatabaseUpdateSingleDataObjectOperation extends DatabaseUpdateOperation 60 { 61 63 70 private String m_strDataObjectName; 71 72 74 84 public DatabaseUpdateSingleDataObjectOperation( 85 DatabaseFactoryImpl factory, 86 String strQueryToPrepare, 87 ModifiableDatabaseSchema schema, 88 Object data 89 ) 90 { 91 super(factory, strQueryToPrepare, schema, DatabaseOperations.DBOP_UPDATE, data); 92 93 m_strDataObjectName = DataConstant.getDataTypeName(factory.getDataType()); 94 } 95 96 98 101 protected void performOperation( 102 DatabaseFactoryImpl dbfactory, 103 Connection cntConnection, 104 PreparedStatement pstmQuery 105 ) throws OSSException, SQLException  106 { 107 ModifiableDataObject objData = (ModifiableDataObject)m_data; 108 int iIndex = 1; 109 iIndex = setValuesForUpdate(pstmQuery, objData, iIndex); 110 111 DatabaseImpl.getInstance().updatedAndFetchGeneratedValues( 112 m_strDataObjectName, cntConnection, pstmQuery, m_dbschema.isInDomain(), 113 ((ModifiableDatabaseSchema)m_dbschema).getModifiableTableNames().get( 114 new Integer (m_iDataType)).toString(), 115 iIndex, objData); 116 setReturnData(objData); 117 } 118 } 119
| Popular Tags
|