Tycodra / API_Playground

0 stars 0 forks source link

Update Project to Use Spring JDBC Template #2

Open brandonwardell20 opened 1 month ago

brandonwardell20 commented 1 month ago

Here is an example: https://spring.io/guides/gs/relational-data-access

The goal is to force us to write SQL queries to retrieve the data for the API. :)

So all the methods will need to be written with SQL, and use parameters.

Tycodra commented 3 weeks ago

Is there a use case where we would use this over a named template? Or should I take this issue to utilize the named parameter as it seems this has evolved?

brandonwardell20 commented 3 weeks ago

I'm not sure what you mean. The namedTemplate is the mechanism that executes the query. The named parameter, or parameter map is an argument passed as a parameter to the named template..

Tycodra commented 3 weeks ago

Sorry, there are two different classes, JdbcTemplate and NamedParameterJdbcTemplate. It seems you can accomplish the same things with both classes, but you can be more exact and explicit with how parameters are handled when you use NamedTemplate. Since the title of the issue only said JdbcTemplate and that is the class you had originally imported, I was uncertain as you used NamedParameterJdbcTemplate elsewhere in newer examples and it seems like it is better.

brandonwardell20 commented 3 weeks ago

Ah, yes. In most cases we are going to be using the namedJDBCTemplate.