EAS主键生成机制
程序员文章站
2022-06-02 15:54:32
...
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();
}
}
上一篇: Oracle数据库 总结
推荐阅读
-
php中Session的生成机制、回收机制和存储机制探究
-
Hibernate主键ID自动生成两种方法示例
-
sqlserver数据库主键的生成方式小结(sqlserver,mysql)
-
mybatis 实现oracle主键自增机制的教程
-
sqlserver数据库主键的生成方式小结(sqlserver,mysql)
-
PowerDesigner中如何生成主键和自增列(SQL SERVER版本)
-
PowerDesigner中如何生成主键和自增列(SQL SERVER版本)
-
asp.net core系列 24 EF模型配置(主键,生成值,最大长度,并发标记)
-
php中Session的生成机制、回收机制和存储机制探究
-
Hibernate 的主键生成策略