๐๐ SPRING CERTIFICATION QUESTION: What is the Template design ๐๐ pattern and what is the JDBC template?
๐๐ SPRING CERTIFICATION QUESTION: What is the Template design ๐๐ pattern and what is the JDBC template?
Answer:
๐๐๐ฆ๐ฉ๐ฅ๐๐ญ๐ 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.๐๐๐