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

Size of the arraylist different after deleting the record?

 
Shubhangi Hanwadikar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This group is very helpful, I found most of my questions already discussed and answered, Thanks.

I have done "must" functionality in the user interface. Now I am working on "delete" functionality, it is working fine. I tested "delete" functionality by writing test program.

Here is the problem:
When I delete the entry I am changing the flag to be invalid and not adding deleted entry in the ArrayList for the GUI. Before I delete any record, the size of the arraylist is 33, let's say I deleted 3 entries, the size of the arraylist is 30. I would get 30 rows on GUI, so when I update any entries on the GUI(book the record), the row count/record number on GUI is different than actual record number. So my customer id is adding at wrong row/record in the GUI. I would like some help regarding this.
Thanks in advance,
Shubhangi
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you deleting records in your GUI in the first place? As far as I know this is certainly not a must requirement, so why spending your valuable time on something that is not asked? You won't get extra credit for it, and only may loose points if it isn't flawless.

And to answer your question: the index in the ArrayList of your GUI should not be related at all to the record number in your database file. If you delete the 5th row for example, it could be record 23 from your database file. So if you store room objects in your List, your room object should have a property recNo (or primaryKey) for example. This thread will be very valuable to you I guess.

Kind regards,
Roel
 
Shubhangi Hanwadikar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply,
I am working on B&S assignment and you are right "delete" is not in the must requirements. My understanding was, I need to provide implementation (??). So in my implementation I am just changing the flag from valid to invalid. If the flag is valid then display it on GUI.

I Agree with you that, ArrayList in GUI and record number of the database should be separate. This is the exact problem I am having, Arraylist in GUI is mapping to different record in database file. So when I book the customer id on GUI, it is updating customer id of different row on GUI.
Thanks,
Shubhangi



 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Shubhangi,

You have to implement the delete method in your Data class, but you don't have to have a functionality in your GUI to actually delete a record. If you want to test your delete method (in your Data class) you could use JUnit for example. Same applies to the create method.

And which code do you use to return the selected record from your List ?

Kind regards,
Roel
 
Shubhangi Hanwadikar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Roel,
I have an arraylist of Contractor with record numbers. So when I populate the GUI with the arrayList, Hide the column of the record number, not display on GUI. When user select the row from the GUI, read the record number for the related row and update the row based on the record number. That's the plan, need to work on implementation. That way I can separate rows in the GUI and record numbers in the database.
Thanks,
Shubhangi
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That sounds as an excellent plan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic