EASキー生成メカニズム

2096 ワード

EASのデータベースにはカスタム関数newbosidがあり、彼の入力パラメータは対応するエンティティのBOSTYPEであり、出力値はPKである.
一般的にインタフェースや他のインタフェースが呼び出されます.方式は大体以下の通りである.
public static void main(String[] paramArrayOfString)
  {
          
        //       
                try {
                        Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
                        //        
                        Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@10.195.36.13:1521:kingdee","eas_tst","eas_tst");
                        CallableStatement  cs = conn.prepareCall("{ ?=call newbosid(?)}");
                        // Register the type of the return value
                        cs.registerOutParameter(1, Types.VARCHAR );
                        // Set the value for the IN parameter
                        cs.setString(2,"E91B6727");
                        
                        // Execute and retrieve the returned value
                        for (int i = 0; i < 20; i++) {                                
                                cs.execute();
                                String str = cs.getString(1);
                                System.out.println(str);
                        }
                } catch (InstantiationException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (IllegalAccessException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (ClassNotFoundException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (SQLException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
  }