• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Design for Maintaining Static Data

 
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hii,

I am planning to create a database utility tool that can allow us to maintain the static data let's say user information , staff details and something like that..

My initial thought was to create a generic web screen that can load the data based on the table name entered and from there allowing to maintian the data ..means insert or update..

Now challenge is it should be generic enough to apply for all static tables..

It should also handle relationship between the tables if any ...

What should be the appropriate approach in this case..
 
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A very common problem for web based systems but have not found any readymade solution yet.The approach I would take
1. Design a class DatabaseInfo which read the database usng JDBC metadata and gets the table list and display this list to user
2. User selects the list
3. Use JDBC Metadata again to read the field names of the table along with their attributes.
4. This information needs to be stored in 2 tables. First table would have the list of tables. Second table would have the fields for each of these tables.
This is first time set up.
Now for data entry , show user the screen which has the list of tables.
User selects a table and then display the fields of the table along with their datatype in the jsp.
user enters the values and he data tyoe validation can be done at the server.
To edit the data, user selects the table, the data is displayed in tabular format with radio buttons next to them.
User selects the edit or delete for any row, and the add screen can be populated with this data.
 
Bhavik Patel
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks..

Is there a way to maintain relationship with the tables..

Lets say Employee and Department table are linked with dept id .. Is it possible to detect the foreign key from the metadata and indicate flag in front end on the table's column to indicate that this column is foreign key so make sure for dependency with the parent table?? any thoughts..
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Foreign keys are in the database metadata for sure. You might have to query the system tables rather than rely on JDBC for that. You could make any foreign key a dropdown or search on the other table. You might need to populate your own metadata to tell you which columns of the other table to display in the dropdown. Wheee.
 
Vinay Singh
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bhavik Patel:
Thanks..

Is there a way to maintain relationship with the tables..

Lets say Employee and Department table are linked with dept id .. Is it possible to detect the foreign key from the metadata and indicate flag in front end on the table's coluhttp://www.javaranch.com/clickServlet?href=http://www.jetbrains.com/teamcity?tc20jr
Team City 2.0mn to indicate that this column is foreign key so make sure for dependency with the parent table?? any thoughts..



Yes you get all that information from JDBC Meta data.
 
Ranch Hand
Posts: 290
Oracle Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
DatabaseMetaData.getImportedKeys(...) AND DatabaseMetaData.getExportedKeys(...)
 
Stan James
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cool. That's better than what I said. Love to learn new stuff here!
reply
    Bookmark Topic Watch Topic
  • New Topic