Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Overview of Java Database coding paradigms

Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Posts: 1266
IBM DB2 Netbeans IDE Spring Java
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
    Bookmark Topic Watch Topic
  • New Topic