Package com.addressbook.dto

Examples of com.addressbook.dto.Phone


    }

    @Override
    public Object findById(Number id)
    {
        Phone phone = null;
        Connection connection = null;
        try
        {
            connection = getDataSource().getConnection();
            PreparedStatement pstmt = connection.prepareStatement("SELECT * FROM addressbook.person");
            ResultSet rs;

            if (pstmt.execute())
            {
                rs = pstmt.getResultSet();
                rs.absolute(id.intValue());
                phone = new Phone();

                phone.setId(rs.getLong("phoneID"));
                phone.setPhoneNumber(rs.getString("phoneNumber"));
            }
        }
        catch (SQLException e)
        {
            e.printStackTrace();
View Full Code Here


        {
            final String sql = "SELECT * FROM addressbook.phone WHERE addressbook.phone.personID=" + userID;
            Connection connection = getDataSource().getConnection();
            PreparedStatement pstmt = connection.prepareStatement(sql);
            ResultSet rs;
            Phone phone;

            if (pstmt.execute())
            {
                rs = pstmt.getResultSet();
                phones = new ArrayList<>();

                while (rs.next())
                {
                    phone = new Phone();
                    phone.setId(rs.getLong("phoneID"));
                    phone.setPhoneNumber(rs.getString("phoneNumber"));

                    phones.add(phone);
                }
            }
        }
View Full Code Here

TOP

Related Classes of com.addressbook.dto.Phone

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.