-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
first commit #381
base: main
Are you sure you want to change the base?
first commit #381
Conversation
@@ -0,0 +1,27 @@ | |||
package mate.academy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package mate.academy; | |
package mate.academy.util; |
src/main/java/mate/academy/Main.java
Outdated
|
||
System.out.println(bookDao.create(book)); | ||
System.out.println(bookDao.findById(4L)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't have book with id = 4
src/main/java/mate/academy/Main.java
Outdated
System.out.println(bookDao.findById(4L)); | ||
System.out.println(bookDao.findAll()); | ||
System.out.println(bookDao.update(book)); | ||
System.out.println(bookDao.deleteById(4L)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same
|
||
@Dao | ||
public class BookDaoImpl implements BookDao { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} catch (SQLException e) { | ||
throw new DataProcessingException("Failed to find books", e); | ||
} | ||
return new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return new ArrayList<>(); | |
return books; |
while (resultSet.next()) { | ||
Long id = resultSet.getObject("id", Long.class); | ||
books.add(creatingBook(resultSet, id)); | ||
return books; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return books; |
} | ||
} | ||
|
||
private Book creatingBook(ResultSet resultSet, Long id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private Book creatingBook(ResultSet resultSet, Long id) { | |
private Book mapResultSetToBook(ResultSet resultSet, Long id) { |
No description provided.