FileDocCategorySizeDatePackage
Person.javaAPI DocExample1537Fri Feb 23 08:12:28 GMT 2001None

Person.java

import java.math.*;
import java.sql.*;

public class Person extends JPerson {
 private Connection conn = null;

 public Person() { 
  super();
 }

 public Person(Connection conn) { 
  super();
  setConnection(conn);
 }

 public BigDecimal getId() throws SQLException {
  BigDecimal id  = null;
  if (conn!=null) {
   Person thisPerson = this;
   CallableStatement cstmt = 
    conn.prepareCall("{ ? = call " + getSQLTypeName() + ".GET_ID( ) }");
   cstmt.registerOutParameter(1, Types.NUMERIC);
   cstmt.execute();
   id = cstmt.getBigDecimal(1);
  }
  return id;
 } 

 public Integer getAge() throws SQLException {
  Integer age = null;
  if (conn!=null) {
   Person thisPerson = this;
   CallableStatement cstmt = 
    conn.prepareCall("{ ? = call " + getSQLTypeName() + ".GET_AGE( ? ) }");
   cstmt.registerOutParameter(1, Types.NUMERIC);
   cstmt.setObject(2, thisPerson);
   cstmt.execute();
   age = new Integer(cstmt.getInt(1));
  }
  return age;
 } 

 public Integer getAgeOn(Timestamp date) throws SQLException {
  Integer age = null;
  if (conn!=null) {
   Person thisPerson = this;
   CallableStatement cstmt = 
    conn.prepareCall("{ ? = call " + getSQLTypeName() + ".GET_AGE_ON( ?, ? ) }");
   cstmt.registerOutParameter(1, Types.NUMERIC);
   cstmt.setObject(2, thisPerson);
   cstmt.setTimestamp(3, date);
   cstmt.execute();
   age = new Integer(cstmt.getInt(1));
  }
  return age;
 } 

 public void setConnection(Connection conn) {
  this.conn = conn;
 }

}