class RegistrationService {

	public User getByEMail(String email) {
		List<User> result = jdbcTemplate.query(
				"SELECT firstname, name, email FROM T_USER WHERE email=?",
				new RowMapper<User>() {

					@Override
					public User mapRow(ResultSet rs, int rowNum)
							throws SQLException {
						return new User(rs.getString("firstname"), rs
								.getString("name"), rs.getString("email"));
					}
				}, email);
		if (result.size() > 1) {
			throw new IllegalStateException(
					"More than one user with the same email!");
		}
		if (result.size() == 0) {
			return null;
		}
		return result.get(0);
	}

}