Package com.addressbook.dto

Examples of com.addressbook.dto.Email


    }

    @Override
    public Object findById(Number id)
    {
        Email email = null;

        try
        {
            Connection connection = getDataSource().getConnection();
            PreparedStatement pstmt = connection.prepareStatement("SELECT * FROM addressbook.person");
            ResultSet rs;

            if (pstmt.execute())
            {
                rs = pstmt.getResultSet();
                rs.absolute(id.intValue());
                email = new Email();

                email.setId(rs.getLong("emailID"));
                email.setEmail(rs.getString("email"));
            }
        }
        catch (SQLException e)
        {
            e.printStackTrace();
View Full Code Here


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

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

                while (rs.next())
                {
                    email = new Email();
                    email.setId(rs.getLong("emailID"));
                    email.setEmail(rs.getString("email"));

                    emails.add(email);
                }
            }
        }
View Full Code Here

TOP

Related Classes of com.addressbook.dto.Email

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.