码迷,mamicode.com
首页 > 数据库 > 详细

PL/SQL EO 设计与开发

时间:2014-10-16 12:37:22      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:style   io   os   使用   ar   for   sp   on   cti   

1.INSERT

调用PL/SQL 去insert的时候,没有使用super(),此时应当自己创建callable statement;

调用checkErrors()方法在执行 callable statement 处理异常后

protected void insertRow()
{
   try
   {
     String insertStmt = "BEGIN INSERT_RECORD( " +
                                  "PARAM1 => :1, " +
                                  "PARAM2 => :2, " +
                                  "PARAM3 => :3, " +
                                  "PARAM4 => :4); END;";

     DBTransaction trxn = getDBTransaction(); 
     CallableStatement insertStmt = trxn.createCallableStatement(insertStmt, 1);    
   
     // Rebind parameters 
     insertStmt.setString(1, getFirstName()); 
     insertStmt.setString(2, getLastName()); 
     insertStmt.setString(3, getAddress1()); 
     insertStmt.setString(4, getAddress2()); 
     // Execute the statement 
     insertStmt.executeUpdate(); 
     // OAExceptionUtils.checkErrors as per PLSQL API standards 
     OAExceptionUtils.checkErrors (txn); 
   } 
   catch(SQLException sqlE) 
   { 
      ... 
   } 
 } 

If you have any calculations for any of your EO columns in your PL/SQL procedure, and if you would like to reflect those values in your EO after row insertion in the database, then you should include those columns in your view object SQL and do the following:

txn.commit();
vo.executeQuery();

清除EO缓存

clearEntityCache() ;

PL/SQL EO 设计与开发

标签:style   io   os   使用   ar   for   sp   on   cti   

原文地址:http://www.cnblogs.com/daodan/p/4028166.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!