aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S Find in .db or in memory? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "B&S Find in .db or in memory?" Watch "B&S Find in .db or in memory?" New topic
Author

B&S Find in .db or in memory?

Julio Cesar Marques
Ranch Hand

Joined: Mar 21, 2009
Posts: 67
Hi Everyone!

I looking for similar question here but i not found anything so i ask:

On the startup of my app client it load all data from .db file and fill JTable (is this correct?).

And my question is: When user perform a find operation i have to search critéria in .db file and fill JTable with results or i filter data inner JTable?

Again sorry about my english.


Julio Cesar Lopes Marques
Sun Certified Java Developer 5, Sun Certified Java Programmer 5
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5545
    
  13

Julio Cesar Marques wrote:Hi Everyone!

I looking for similar question here but i not found anything so i ask:

On the startup of my app client it load all data from .db file and fill JTable (is this correct?).

And my question is: When user perform a find operation i have to search critéria in .db file and fill JTable with results or i filter data inner JTable?

Again sorry about my english.


I can tell you just what i did:

Q1: i didn't load all records at startup, because if db keeps growing it would be very slow and maybe a whole lot of the records are of no use at all. but that's your own choice to make and describe it in your choices.txt

Q2: i do a search in the db, the returned records are filtered (on exact match), the records that meet the criteria are added to the JTable, so the table stays as simple as possible (no filters, no column sorters,... just an own TableModel containing the records that match)


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Julio Cesar Marques
Ranch Hand

Joined: Mar 21, 2009
Posts: 67
Ok Tanks buddy!

So in first Load my DataModel is Empty?
And when i create a new rec? i put it in empty data model or do anything (popup a sucess msg maybe)?
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5545
    
  13

you may load the data at startup, it's a choice up to you

as far as i know you don't have to create records. just searching for records and booking (updating) one is required. so i didn't create any records
Julio Cesar Marques
Ranch Hand

Joined: Mar 21, 2009
Posts: 67
Maybe we don't talking about same thing...

Ok i'll not bring data on the first load OK?
But after screen rendered to user the user click in new Button (to create a new CSR), this is about
public int create(String[] data) method. On create a new record in .db file i have to put this record in my local table or not?

Best Regards!!
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5545
    
  13

i don't have a new-button in my gui, because it's not necessary in my assignment to create new records at the GUI (i did implement the create method from sun's interface of course).

But if i would have to add a new record, this is how i should do it:
- user hits "new" button
- application opens dialog to enter the record details
- user hits ok
- application calls the create-method of Data-class and new record is inserted in the db-file
- if it succeeds i show a message to let user know the record was added successful (because the result table show eg. results of a search on name="Roel" and user just added record with name="Julio", so it should not be in the result table in my opinion)

Kind regards,
Roel
Julio Cesar Marques
Ranch Hand

Joined: Mar 21, 2009
Posts: 67
It's the point!!
Thanks man!
 
Consider Paul's rocket mass heater.
 
subject: B&S Find in .db or in memory?