You have a privilege to create a quiz (QnA) related to this subject and obtain creativity score...
What does it mean to handle data in Java?
Looking back to the JDBC section, you can recollect five steps and associated code samples. Connecting to a database, sending a query and processing the results requires very precise coding with multiple try/catch statements surrounding this code. Besides that obvious challenges there are hidden obstacles related to small differences between specific data vendors in handling different data types. JDBC coding became error prone, time consuming and boring procedures.
Another challenge is a mixture of Java and SQL languages together in JDBC coding.
Java developers created reusable libraries or frameworks that significantly cut data handling efforts. These frameworks also take care of implementation even more complex concepts, such as Transactions and Pool of Connections.
These frameworks also take care of implementation even more complex concepts, such as Transactions and Pool of Connections.
Was it clear so far?
What is a Transaction? While changing data, we have situations, when several changes must be considered as a single atomic operation. If any of the changes failed, the program should UNDO all changes. This is the Transaction concept. It is usually implemented with data handling frameworks, which allow developers to start several operations with the single line beginTransaction and end the transaction with the lines endTransaction and commit. In the case of failure the program would jump to another line rollback, which means UNDO all transaction changes.
What is a Pool of Connections? Describing five steps of handling data we should add that the very first step, getting a connection with a database, is the most expensive in terms of time and resources. When many users access data, for example, via a web site, establishing a connection for each user would easily kill the server. A better policy is to establish upfront a pool of connections with the database and as soon as user is done with data access reuse this connection for another data request.
We will briefly consider Hibernate, which focuses on mapping Java objects to relational nature of SQL.
You will learn introduction into the Spring framework, which follows its main principle Inversion of Control, giving a container or its framework control on routine functions of the code and allowing developers to focus on business specifics.
And we will consider several JDBC utilities as the introduction to the Data Service framework.