Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Insert statement for a 70 columns database table

 
Srikanth Raghavan
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Do we have to hard-code the column names and indexes in our program?

I have a database table which contains 70 columns. And my insert statement is looking like a beast. I am hard-coding the column indexes and column names in my program, although I have it in one place in the form of an enum. Is this how all the JDBC programs work? I am smelling something wrong with this approach.

I don't know anything about Hibernate, but is it the solution for this problem?

-- Srikanth
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hibernate (or any ORM) would remove the boiler plate code you have to write.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic