zoukankan      html  css  js  c++  java
  • PL/SQL EO 设计与开发

    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() ;

  • 相关阅读:
    路由重分布(二)
    linux系统命令的收集 第一部分
    如何在VM软件中安装Linux系统
    Spring boot连接MongoDB集群
    jQuery中防止表单提交两次的方法
    Java中使用HTTP阻塞式调用服务器API
    本地项目初始化git推送到服务器
    前端页面调用Spring boot接口发生的跨域问题
    jQuery中异步问题:数据传递
    Git中修复bug
  • 原文地址:https://www.cnblogs.com/daodan/p/4028166.html
Copyright © 2011-2022 走看看