📄 employee.java
字号:
import java.sql.*;import oracle.sql.*;public class Employee extends Person{ static final Employee _factory = new Employee (); public NUMBER empid; public CHAR mgr; public static ORADataFactory getFactory() { return _factory; } public Employee () {} public Employee (NUMBER ssn, CHAR name, CHAR address, NUMBER empid, CHAR mgr) { super (ssn, name, address); this.empid = empid; this.mgr = mgr; } public Datum toDatum(Connection c) throws SQLException { StructDescriptor sd = StructDescriptor.createDescriptor("SCOTT.EMPLOYEE_T", c); Object [] attributes = { ssn, name, address, empid, mgr }; return new STRUCT(sd, c, attributes); } public ORAData create(Datum d, int sqlType) throws SQLException { if (d == null) return null; Object [] attributes = ((STRUCT) d).getOracleAttributes(); return new Employee((NUMBER) attributes[0], (CHAR) attributes[1], (CHAR) attributes[2], (NUMBER) attributes[3], (CHAR) attributes[4]); } public String toString () { try { return "SCOTT.STUDENT_T: ssn="+ssn.intValue()+ " name="+name.stringValue()+ " address="+address.stringValue()+ " empid="+empid.intValue()+ " mgr="+mgr.stringValue(); } catch (SQLException e) { // ignore the error } return "some error happened"; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -