WebLogic Server中CMP實體bean的性能調優[7]

發表于:2010-03-11來源:作者:點擊數: 標簽:CMPBeanWeblogic實體SERVER
WebLogic Server中CMP實體bean的性能調優[7] 性能測試工具 下面基于 Cactus 的測試驗證了該行為。假定一個Person CMP bean是利用樂觀并發部署的,并且cache-between-transaction被設置為true: ... public class OptimisticLockingTest extends Servlet Test

  WebLogic Server中CMP實體bean的性能調優[7]  性能測試工具 

   下面基于Cactus的測試驗證了該行為。假定一個Person CMP bean是利用樂觀并發部署的,并且cache-between-transaction被設置為true:

  ...

  public class OptimisticLockingTest extends ServletTestCase {

  private UserTransaction tx;

  protected void setUp() throws Exception {

  super.setUp();

  Context context = new InitialContext();

  this.tx = (UserTransaction)context

  .lookup("javax/transaction/UserTransaction");

  }

  public void testCacheBetweenTransactions() throws Exception {

  PersonLocalHome localHome = (PersonLocalHome)Locator

  .getLocalHome(PersonLocalHome.JNDI_NAME);

  // create record via CMP in first transaction

  this.tx.begin();

  PersonLocal local = localHome.create();

  local.setName("John");

  Long pk = local.getPrimaryKey();

  this.tx.commit();

  // update some field(s) via direct JDBC call in another

  // transaction. Assume that updatePersonNameViaJdbc()

  // method will update version column as well

  String newName = "Paul";

  this.tx.begin();

  updatePersonNameViaJdbc(pk, newName);

  this.tx.commit();

  // find CMP again and try to update name in yet

  // another transaction

原文轉自:http://www.anti-gravitydesign.com

国产97人人超碰caoprom_尤物国产在线一区手机播放_精品国产一区二区三_色天使久久综合给合久久97