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

Solved task jv-jdbc-intro: #351

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

Conversation

ASelivonchyk
Copy link

  • implemented BookDao class with CRUD operations to retrieve needed data from DB;
  • created util class - ConnectionUtil to establish connection with DB;
  • added DbException and DataProcessingException as custom exceptions;
  • all application constants moved for separate Constants class;
  • used app.properties file for common variables;
  • edited init_db.sql for creating DB schema and table;
  • in pom.xml added necessary dependency;

- implemented BookDao class with CRUD operations to retrieve needed data from DB;
- created util class - ConnectionUtil to establish connection with DB;
- added DbException and DataProcessingException as custom exceptions;
- all application constants moved for separate Constants class;
- used app.properties file for common variables;
- edited init_db.sql for creating DB schema and table;
- in pom.xml added necessary dependency;
.prepareStatement(SAVE_BOOK_QUERY, Statement.RETURN_GENERATED_KEYS)) {
createBookStatement.setString(1, book.getTitle());
createBookStatement.setBigDecimal(2, book.getPrice());
createBookStatement.executeUpdate();

Choose a reason for hiding this comment

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

Do you need to check affected rows?

Copy link
Author

Choose a reason for hiding this comment

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

I don't think so.

package mate.academy.exception;

public class DataProcessingException extends RuntimeException {

Choose a reason for hiding this comment

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

Suggested change

import mate.academy.exception.DbException;

public class ConnectionUtil {
private static final Properties dbProperties = new Properties();

Choose a reason for hiding this comment

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

Suggested change
private static final Properties dbProperties = new Properties();
private static final Properties DB_PROPERTIES = new Properties();

constant naming convention

package mate.academy.exception;

public class DbException extends RuntimeException {

Choose a reason for hiding this comment

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

Suggested change

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