File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Retaining DB values as well as Dynamically generated Values.. Help  Needed ! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Retaining DB values as well as Dynamically generated Values.. Help  Needed !" Watch "Retaining DB values as well as Dynamically generated Values.. Help  Needed !" New topic
Author

Retaining DB values as well as Dynamically generated Values.. Help Needed !

Bunty Jha
Greenhorn

Joined: May 22, 2008
Posts: 2
In my application i have a list of records coming from database (DB)

say 'Family members' of an employee

it appears on page like :

sl no. member_name relation Action
1johnson delete
2marrydaughter delete

[Add Another Family Member]

Now we have an option of dynamically adding a row

Problem :

1 . suppose I add 4 more family members till serial number 6 (2 records are already exists in database )
and then deleteany one of records by clicking action delete button for corresponding row , it deletes that entry from database but also all entries that were dynamically added
also gets lost due to page reload .
how to retain the dynamically entered values ??


2 . here comes one more issue , i have a serial number column in database and employee code as PK ,
now the requirement is if any record in middle is deleted , the serial numbers must maintain order .. i.e if record having sl no 3 is deleted
the the subsquent records must be re numbered as 3,4,5 ...

How to renumber the serial numbers ?


Please do help ,

thanks
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
Welcome to JavaRanch

Have you really got the serial numbers as a composite PK and wich to change the serial numbers? That's not possible, surely?

How about creating a view or temporary table with the details you require, select and order by serial number, then add a new row number?

Please ask Rob or Ernest to transfer this thread to the JDBC forum.
Bunty Jha
Greenhorn

Joined: May 22, 2008
Posts: 2
Thanks for your suggestion .

what can i do for problem 1.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
To solve problem 1: redesign your database to take the serial number out of the PK.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Retaining DB values as well as Dynamically generated Values.. Help Needed !