WebSphere Application Server Network Deployment, Version 6.1   
             オペレーティング・システム: AIX , HP-UX, Linux, Solaris, Windows, Windows Vista

             目次と検索結果のパーソナライズ化

例: OCC データの衝突および JDBC メディエーター例外の強制

以下の例は、衝突を強制して検出を実証し、結果として発生する例外を表示します。

// This example assumes that a mediator has already 
// been created and the first name in the list is Sam.  
// It also assumes that the Customer table has an OCC 
// column and the metadata has set this column to be 
// the collision column.

DataObject graph1 = mediator.getGraph();
DataObject graph2 = mediator.getGraph();
  
DataObject customer1 = (DataObject)graph1.getList("CUSTOMER").get(0);
customer1.set("CUSTFIRSTNAME", "Bubba");
  
DataObject customer2 = (DataObject)graph2.getList("CUSTOMER").get(0);
customer2.set("BOWLERFIRSTNAME", "Slim");
 
mediator.applyChanges(graph2);
  
try   
{
 mediator.applyChanges(graph1);
} 
catch (OCCException e)
{
// Since graph1 was obtained before graph2 and 
// graph2 has already been submitted, trying to 
// apply the same changes to graph1 causes 
// this OCC Exception.

assertEquals("Sam", e.getOriginalDO(). getString("CUSTFIRSTNAME"));
assertEquals("Bubba", e.getChangedDO(). getString("CUSTFIRSTNAME"));
assertEquals("Slim", e.getDatabaseDO(). getString("CUSTFIRSTNAME"));
}



関連概念
並行性制御
関連資料
JDBC メディエーター・トランザクション
参照トピック    

ご利用条件 | フィードバック

最終更新: Jan 21, 2008 7:44:53 PM EST
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/rdat_occcollision.html