ps.executeUpdate();
} finally {
Database.dispose(ps);
}
} catch (SQLException e) {
throw new PersistenceException("Failed to update user.", e);
} finally {
Database.dispose(conn);
}
} else {
Connection conn = null;
try {
conn = Database.createConnection();
PreparedStatement ps = null;
try {
ps = conn.prepareStatement(UserPersistenceImpl.UPDATE_USER);
ps.setString(1, profile.getHandle());
ps.setString(2, profile.getPassword());
ps.setString(3, profile.getEmail());
ps.setString(4, profile.getFirstName());
ps.setString(5, profile.getLastName());
ps.setString(6, profile.getAddressLine1());
ps.setString(7, profile.getAddressLine2());
ps.setString(8, profile.getCity());
ps.setString(9, profile.getState());
ps.setLong(10, profile.getCountry().getId());
ps.setString(11, profile.getZipCode());
ps.setString(12, profile.getPhoneNumber());
ps.setTimestamp(13, new Timestamp(profile.getBirthDate().getTime()));
ps.setString(14, "" + profile.getGender());
ps.setString(15, profile.getSchool());
ps.setString(16, profile.getMajor());
ps.setBoolean(17, profile.isGraduateStudent());
ps.setInt(18, profile.getGraduationYear());
ps.setString(19, profile.getStudentNumber());
ps.setBoolean(20, profile.isConfirmed());
ps.setLong(21, user);
ps.setTimestamp(22, new Timestamp(new Date().getTime()));
ps.setString(23, profile.getNickName());
ps.setLong(24, profile.getId());
ps.executeUpdate();
} finally {
Database.dispose(ps);
}
} catch (SQLException e) {
throw new PersistenceException("Failed to update user.", e);
} finally {
Database.dispose(conn);
}
}
}