I wonder if my Java colleagues would agree with or have comments on the following outline of the three paradigms of working with relational databases:
• JPA/Hibernate Repositories, annotated and autowired, with implicit methods that you don’t even have to write.
This is the latest paradigm, simplest to code.
Cons: You have limited control over HOW it does what it does; debugging is opaque and difficult; performance may be compromised; some senior managers may prohibit you from using this.
• JDBCTemplates: More explicit SQL coding
Pros: Better control; easier to debug; may perform better
Cons: More code to write
• Classic JDBC: DataSource, Connection, Statement, PreparedStatement, CallableStatement, ResultSet
Skip this if you think you’re never going to work in such a “retro” paradigm.
Pros: Tried and true; maximum control and performance
Cons: Maximum tedium coding low-level details.
Nice question for a debate, added a couple of flags.
My two cents: for various reasons, I had and currently have to work with pure jdbc, but at the very end I need to write some helper classes to reduce boilercode you inevitably need to write when using prepared statements, result sets and so on. Personally I'd follow JPA, and I would not rely to much upon Spring data facilities. Spring is really really good, but tends IMHO to automagically do too much things, and most of times I needed more control over data access.
He was giving me directions and I was powerless to resist. I cannot resist this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!