Skip to content
This repository was archived by the owner on Jul 3, 2024. It is now read-only.

Update pom.xml #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
<version>1.4.1.RELEASE</version>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ public class UserRepository {
* Creates a new user on the database.
*/
public void insert(User user) {
String sql = "INSERT INTO USER(NAME, EMAIL, PASSWORD) VALUES (?, ?, ?)";
String sql1 = "INSERT INTO USER(NAME, EMAIL, PASSWORD) VALUES (?, ?, ?)";
KeyHolder holder = new GeneratedKeyHolder();

this.jdbcTemplate.update((connection) -> {
PreparedStatement pstmt = connection.prepareStatement(sql);
PreparedStatement pstmt = connection.prepareStatement(sql1);
pstmt.setString(1, user.getName());
pstmt.setString(2, user.getEmail().toLowerCase().trim());
pstmt.setString(3, user.getPassword());
Expand All @@ -55,7 +55,7 @@ public void insert(User user) {
* @return The user with the provided ID.
*/
public User find(int id) {
String sql = getBaseQuery() + " WHERE ID = ?";
String sql = getBaseQuery() + "WHERE ID = ?";
return this.jdbcTemplate.queryForObject(sql, new Object[] { id }, ROW_MAPPER);
};

Expand All @@ -64,7 +64,7 @@ public User find(int id) {
*/
public User find(String email) {
try {
String sql = getBaseQuery() + " WHERE EMAIL = ?";
String sql = getBaseQuery() + "WHERE EMAIL = ?";
return this.jdbcTemplate.queryForObject(sql, new Object[] { email.toLowerCase().trim() }, ROW_MAPPER);
} catch (EmptyResultDataAccessException e) {
return null;
Expand Down