Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

oleksii-sukhenko
Copy link

No description provided.

@@ -0,0 +1,27 @@
package mate.academy;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
package mate.academy;
package mate.academy.util;


System.out.println(bookDao.create(book));
System.out.println(bookDao.findById(4L));

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

System.out.println(bookDao.findById(4L));
System.out.println(bookDao.findAll());
System.out.println(bookDao.update(book));
System.out.println(bookDao.deleteById(4L));

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 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

} catch (SQLException e) {
throw new DataProcessingException("Failed to find books", e);
}
return new ArrayList<>();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return new ArrayList<>();
return books;

while (resultSet.next()) {
Long id = resultSet.getObject("id", Long.class);
books.add(creatingBook(resultSet, id));
return books;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return books;

}
}

private Book creatingBook(ResultSet resultSet, Long id) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private Book creatingBook(ResultSet resultSet, Long id) {
private Book mapResultSetToBook(ResultSet resultSet, Long id) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants