• Post Reply Bookmark Topic Watch Topic
  • New Topic

UB 1.3.3 find & create  RSS feed

Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some questions again:

1. String[] data is (key does not go to db, just index):
a) key,name,city..
b) name, city..
c) other, what?

It must allow the user to search the data for all records, or for records where the name and/or location fields exactly match values specified by the user.

2. String[] criteria contains (all fields must be used?)
c) other, what?

3. I need to provide to GUI functionality
a) search with all fields
b) search with name and/or location
c) other, what?

And finally design points (comments?):

Uses DBCache, file is read in the beginning
  • synchronized Singleton
  • all member variables private

  • DBCache contains data + schema
  • used helper class to populate & read data
  • don't start if magic cookie don't match

  • DBRecords contains (in DBCache) (LinkedHashMap<Integer, DBRecords>):
  • index(record number),record(actual record)
  • one DBRecord contains(LinkedHashMap<Integer, String>
  • index (way to match against schema), value of the field

  • creation & find uses schema to determine field lengths + amount of fields in db-file (that's why i'm asking all these questions)

    Properties are read from file. Own class extends java.util.Properties
  • magic cookie (set/get)
  • db-file location (set/get)

  • Thanks

    ps. used time 8,5h
    Posts: 11338
    AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    looking good. used approximately the same approach

    concerning your questions about find and create. i guess they take both an array which contains as many fields as the db model. i check the length of the array to the db-model. if it's not the same i throw IllegalArgumentException

    and your find method will have to return more records than you might show in your gui, because you don't have an option if you have to search on (name and location) or (name or location). so you have to return all records starting with specified name or with the specified location. and in your business layer you have to filter the returned array depending on which choice the user made.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!