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

  • 相关阅读:
    kafka原理深入研究 (转 )
    redis——持久化篇
    IDEA 配置环境和相关工具整理(新手入门)
    Spring Data JPA(官方文档翻译)
    springboot:spring data jpa介绍
    JDK8-十大新特性-附demo
    JDK8新特性一览
    Maven中的pom.xml配置文件详解
    数据库面试题(更新中...)
    互联网协议系列
  • 原文地址:https://www.cnblogs.com/daodan/p/4028166.html
Copyright © 2020-2023  润新知