Is it efficient to queryupdate database at every transaction: Java Application

I am designing a real time book management system in java. So I need to save all users, books, transactions in database(3 tables users, books, transactions). I have implemented JDBC for this.

So, I would like to know which one is better among

1) Querying and updating database all the time, say I have to authenticate user from usertable or query for a book from book table

OR

2) First query the database once application starts and store respective tables in Hashset and iterate the HashSet while updating or querying and update all Hashset ‘s into database at the end of execution.


Source: mysql

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.