Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Please Help!!! Generic Database Access Class  RSS feed

david powell
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am developing an application in java which will query and update/delete from a database (I am currently using an Access database for a prototype). The problem I have got is that I have a database schema which has relations such as - 'one client to many products'. E.g - I have got a client table and a product table with the clients primary key as the foriegn key in the product table. Amyway, at present, I have got java classes to reflect this data structure - so my client class contains a vector of product objects. I am attemting to find a generic way of executing the sql statments - at the moment, I am hard coding all sql statements which is obviously no good! I want to be able to send an object to the database and have a generic method for 'insert' which will identify the correct table and update it. (has anyone out there developed a generic database access class?)I hope this makes sense but it is difficult to explain! Any help at all would be really appreciated! Thanks in advance!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!