𝐓𝐞𝐦𝐩𝐥𝐚𝐭𝐞 design pattern, commonly known as 𝐭𝐞𝐦𝐩𝐥𝐚𝐭𝐞 𝐦𝐞𝐭𝐡𝐨𝐝 defines series of steps 🪜 which are executed in a particular order.
This order cannot be changed ❌🔄️, but some of the steps can be altered or are required to be implemented by a subclass.
𝐽𝑑𝑏𝑐𝑇𝑒𝑚𝑝𝑙𝑎𝑡𝑒 is a class that implements template method design pattern and performs some boilerplate JDBC operations 🧮.
Thus the user is only required to define SQL statements and result set custom mappings 🔗.
Operations that are performed by the Jdbc template:
- Open 📭 the connection
- Prepare, and execute ⚡ statements
- Iterate ▶️ through the result set
- Exception 🪲 processing
- Transaction handling
- Close 📴 connection, statement, the result set
Operations that should be performed by the Jdbc template client:
- Define connection 🔌 parameters
- Specify SQL statement and its parameters
- Specify mappings 🔗 for each result set iteration
Examples of mentioned terms:
𝑓𝑖𝑛𝑑𝐵𝑦𝐶𝑢𝑠𝑡𝑜𝑚𝑒𝑟𝐼𝑑 - demonstrates a basic example of a template method design pattern.👇👇👇