Package samples

Examples of samples.Person


                                                         username,
                                                         password);
            // CREATE PERSON AND SERIALIZE
            PersonSerializer.init(con);
            GregorianCalendar cal = new GregorianCalendar(2000,10,5);
            Person p = new Person("ter","555-11-2222",cal.getTime(), 9);
            p.roles = new String[] {"ceo", "janitor"};
            cal.set(2001, 01, 01);
            Date a = new Date(cal.getTimeInMillis());
            cal.set(2002, 02, 02);
            p.vacation = new Date[] {a, cal.getTime()};
            PersonSerializer.savePerson(con, p);        // SAVE Person TO DB
            // READ PERSON BACK IN
            String q="SELECT * FROM Person WHERE ID=1"; // GET FIRST Person
            Statement stat = con.createStatement();
            ResultSet rs = stat.executeQuery(q);
            rs.next();
            Person back = PersonSerializer.nextPerson(con, rs);
            System.out.println("read back: "+back);
            rs.close();
           
            con.close();
            System.out.println("OK");
View Full Code Here


  }

  public static samples.Person nextPerson(Connection con, ResultSet rs)
      throws SQLException {
    int Person_ID = rs.getInt("ID");
    samples.Person o = new Person();
    o.name = rs.getString("name");
    o.SSN = rs.getString("SSN");
    o.birthDay = rs.getDate("birthDay");
    o.age = rs.getInt("age");
    o.roles = get_Person_roles(con, Person_ID);
View Full Code Here

TOP

Related Classes of samples.Person

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.