• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java movie rental database project  RSS feed

 
Alex Breault
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Modify this JAVA code to meet these requirements:

When your application starts, it reads a customer name and password from the command line. It validates them against the database and retains the customer id throughout the session. All rentals/returns are on behalf of this single customer: to change the customer you will quit the application and restart it with another customer. Much of this logic is already provided in the starter code. Once the application is started, the user can select one of the following transactions. (We call each action a transaction. You will need to write some of them as SQL transactions. Others are interactions with the database that do not require transactions.)

1.The "search" transaction: the user types in a string, and you return:

• all movies whose title matches the string

• their producer(s)

• their actor(s)

• an indication of whether the movie is available for rental (remember that you can rent the movie to only one customer at a time), or whether the movie is already rented by this customer (some customers forget: be nice to them), or whether it is unavailable (rented by someone else). The starter code already returns the movies and producers: you still need to retrieve and print the actors and the availability status. In the starter code, the producers are obtained using a "dependent join" (sometimes called "nested loop join"). you should use the same technique for retrieving the actors: there is a more efficient way, but we'll implement that in "fastsearch".

2.The "plan" transaction: Here, the customer types in a plan id and you set his/her new plan to this plan id. How do the customers know what plan ids are available? They type in "plan" without any plan id, and then you will list all available plans, their names, and their terms (maximum number of movies available for rental and monthly fees). What you will learn in 2: simple database updates from Java.

3.The "rent" transaction: The user types in a movie id, and you will "rent" that movie to the customer.

4. The "return" transaction: The user types in the movie id to be returned. You update your records to mark the return.

5. The "fastsearch" function. Here, you will fix the performance problem in the "search" function: "fastsearch" has exactly the same functionality as "search" (except that it doesn't have to return the availability status). However, in “fastsearch” all the dependent joins are replaced with regular joins, executed in the database engine. Specifically, you will first have a query that retrieves all the movie_ids that satisfy your search criterion, and the corresponding titles.

Second, you will have a query that retrieves all the movie_ids that satisfy your search criterion, and the corresponding producers.

Third, you will have a query that retrieves all the movie_ids that satisfy your query and the corresponding actors. Add ORDER BY to each of these queries, so you can merge-join the three streams efficiently in your Java code.

 
Carey Brown
Saloon Keeper
Posts: 3310
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a specific question?
 
Alex Breault
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carey Brown,
There are 5 methods that i need to complete
 
Carey Brown
Saloon Keeper
Posts: 3310
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, pick one and go for it.  If you get stuck then post your code for that piece and let us know what you're stuck on.

This seems like a homework assignment. We can help guide you when you get stuck but we can't write it for you.
 
Carey Brown
Saloon Keeper
Posts: 3310
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you installed the two databases? Are the DB servers up and running? Have the database and tables been created?
 
salvin francis
Bartender
Posts: 1653
37
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to follow proper naming conventions. Most of the time, the code written by you is maintained by someone else. In such scenarios, it would be confusing by some to follow your custom naming conventions. "MySqlServerUrl", "_search_statement","transaction_login" are such examples of poor naming conventions.
Refer to this link : http://www.oracle.com/technetwork/java/codeconventions-135099.html
It is outdated, but still relevant.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!