Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX contractor

 
Manoj Gundawar
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a question about the way I have implemented and used interface methods:
In the provided interface Search is the only method which returns record No. Read returns array of String.
So because of this I implement the Update method as follows:
a. As I don't have the record number of the record that is being populated on the JTable (model has vector), whenever user updates the record (or rather book the record) I do following operations:
a. Take name and location of this record and make a search on name and location. Get the record no from the search result.
b.Update this record number by calling update, as it's arguments are Rec NO and Strings.
Even in case of delete I follow the same: 1. Search to get the rec no and then perform delete.
Is this an acceptable design??

I could have added the record No as part of the returned Strings from the Read, but I did not do so for the following reasons:
1. It is not really any part of the schema. So when it comes to the client side from read, I didn't want to have any special operation to just extract the data without rec no to display on table.
2. I didn�t want to add Rec No as a column in the table, as I generate these columns from the FieldInfo Object, which is generated after reading schema. So this way my client(table) design is more generic, which I didn't want to disturb.
Please let me know if this is an acceptable way to do or is there any more efficient way to do.
At a times I don�t feel this is good design cause it makes so many reads. For example for a simple update, it reads the whole database to search this record just to get the record NO.
Please give me your valuable inputs.
Thanks,
Manoj
[ September 16, 2003: Message edited by: Jmannu gundawar ]
[ September 16, 2003: Message edited by: Jmannu gundawar ]
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jmannu,
a. As I don't have the record number of the record that is being populated on the JTable (model has vector),

There is the problem IMO.
a. Take name and location of this record and make a search or name and location. Get the record no from the search result.
b.Update this record number by calling update, as it's arguments are Rec NO and Strings.
Even in case of delete I follow the same: 1. Search to get the rec no and then perform delete.
Is this an acceptable design??

No, because you cannot be sure that all name/location pairs are unique.
I could have add the record No as part of returned Strings from the Read, but I did not do so as:

And you are right. But as you say yourself search returns record numbers, and what you display in your JTable is indirectly a search result. So what prevents you to add those recNos in your TableModel (even if not in its view) ?
Regards,
Philippe.
 
Manoj Gundawar
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Philippe!
You are right. The search result won�t be unique. And it never struck to me that I already have the
Record no when I do the search.
As suggested I have added it to the tablemodel (as non-visible part) and things are working fine.
Thanks for your inputs. My code has been reduced drastically and I am feeling great about it
Thanks,
Manoj
 
ChenYa Ko
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jmannu
As you write
---------------------------------------------------------------------------
I have added it to the tablemodel (as non-visible part) and things are working fine.
---------------------------------------------------------------------------
How to set tablemodel with non-visible part(column)?
Regards,
ChenYa
[ September 17, 2003: Message edited by: ChenYa Ko ]
[ September 17, 2003: Message edited by: ChenYa Ko ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic