Package trader.model

Examples of trader.model.Person


                    // the id must not be null
                    statement.executeUpdate("ALTER TABLE Person ALTER id SET NOT NULL");
                    // get all entries in the table 'Person'
                    rs = statement.executeQuery("SELECT * FROM Person");
                    while (rs.next()) {
                        Person person =
                                new Person(rs.getString("firstname"), rs.getString("surname"),
                                        rs.getBoolean("sex"));
                        // add the hashCode as id
                        statement.executeUpdate("UPDATE Person SET id = '" + person.getId()
                                + "' WHERE id = 'P-NULL' AND firstname = '" + person.getFirstname()
                                + "' AND surname = '" + person.getSurname() + "' AND sex = "
                                + person.getSex());
                    }
                    // Update the version number
                    version = 2;
                }
                if (version == 2) {
View Full Code Here


        try {
            Statement statement = con.createStatement();
            // Checks if the person already exists in the database by using the id.
            String sql = "SELECT * FROM Person WHERE id = '" + id + "'";
            ResultSet rs = statement.executeQuery(sql);
            Person person = null;
            if (rs.next()) {
                // finds the person int the database
                Person father = null;
                String fatherId = rs.getString("fatherId");
                if (!fatherId.trim().equals("P-NULL")) {
                    father = getPerson(fatherId);
                }
                Person mother = null;
                String motherId = rs.getString("fatherId");
                if (!motherId.trim().equals("P-NULL")) {
                    mother = getPerson(motherId);
                }
                person =
                        new Person(father, mother, rs.getString("firstname"),
                                rs.getString("surname"), rs.getBoolean("sex"));
                StringBuilder childrenSQL = new StringBuilder();
                String string = rs.getString("children");
                if (string != null) {
                    childrenSQL.append(string);
View Full Code Here

            // Checks if the person already exists in the database by using the id.
            String sql = "SELECT * FROM Person";
            ResultSet rs = statement.executeQuery(sql);
            while (rs.next()) {
                // finds the person int the database
                Person father = null;
                String fatherId = rs.getString("fatherId");
                if (!fatherId.trim().equals("P-NULL")) {
                    father = getPerson(fatherId);
                }
                Person mother = null;
                String motherId = rs.getString("fatherId");
                if (!motherId.trim().equals("P-NULL")) {
                    mother = getPerson(motherId);
                }
                persons.add(new Person(father, mother, rs.getString("firstname"), rs
                        .getString("surname"), rs.getBoolean("sex")));
                StringBuilder childrenSQL = new StringBuilder();
                String string = rs.getString("children");
                if (string != null) {
                    childrenSQL.append(string);
View Full Code Here

TOP

Related Classes of trader.model.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.