Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA PROGRAMMING create a CRUD application for a Book database (bookdb) with two tables. Author table AuthorID (number, PK) FirstName (varchar(30), not null) LastName (varchar(30),
JAVA PROGRAMMING
create a CRUD application for a Book database (bookdb) with two tables.
Author table
- AuthorID (number, PK)
- FirstName (varchar(30), not null)
- LastName (varchar(30), not null)
Book table
- ISBN (number, PK)
- Title (varchar(50), not null)
- AuthorID(number, foreign key, not null)
- Write a SQL code to create these two tables in a dummy database using NetBeans JavaDB network server (name your database testauthorbookdb). Put your screenshots showing that these two tables are created successfully by running your SQL code. 5 points.
- Insert 3 different authors and 3 books related to those authors you added. Show your work. 5 points.
- Try to add an existing author and an existing book into database. Show primary key violation. 5 points.
- Try to add a new book into database for an author that does not exist in your database. Show foreign key violation. 5 points.
- Put those SQL code in a file named as V1_something.sql, V2_something.sql under db.migrations so you can create those tables via FlyWay. Try to give meaningful names to your SQL files. Show your work. 5 points.
- Name your database as authorbookdb so FlyWay will create a databasefolder as authorbookdb. Hint: check DB.java. Put screenshot of your DB.java. 5 points.
- Modify entity classes. Put screenshot of your Author.java and Book.java. 5 points each.
- Modify entityDAO classes. Put screenshot of your AuthorDAO.java and BookDAO.java. 5 points each. (If you modified DAO.java, put screenshot of that one too.)
- Modify the main method to test your CRUD application for the following tasks. If your application does not run, you will get zero points for this part. Show your work by putting screenshots from your running application. 5 points for each task.
- Add 3 of your favorite Authors.
- Add one of your favorite books from each author.
- Pick one author and update his/her first name.
- Pick one book and update its title.
- Pick one book and update its authorid to a non-existing author (foreign key violation).
- Modify the main method (keep the previous code from task 9) to add a user input logic for your CRUD. So user can perform CRUD operations on two tables. 2.5 points for each task (except option 9).
- Option 1,2,3,4 for CRUD on Author table.
- Option 5,6,7,8 for CRUD for Book table.
- Option 9 for Exit (5 points).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started