Edit table and write changes back to DB

Hi All,
I created a test program that uses AbstractTableModel to display the results of an SQL select statement in a JTable. I want to proceed to the next step which to edit cells and then write the changes back to the DB.
I imagine making a number of edits, then clicking a "save" buton and then looping through the table and checking for updated rows and then sending the sql update statements to the db.
I've spent most of this afternoon researching JTables, but am still uncertain as to where to go from here, so now I'm asking for someone to point me in the right direction.
This is where I'm at:
* I've implemented the getRowCount, getColumnCount, isCellEditable and getValueAt methods.
* My model doesn't use any vectors, or other array storage for the data, it just uses the JDBC ResultSet methods absolute(rowNumber) and getObject( colNumber)
* Whenever I edit a cell, the value reverts back to it's original. I assume this is because I havn't implemented setValueAt() yet.
In my current setup, I'm not sure how I should implement setValueAt() since all I have is the JDBC result set. Should I be implementing some kind of sparse array to hold modified data, and use that to hold updated rows? Presumably, non updated rows could still be obtained from the JDBC result set.
Anyway, I'd like to hear your advice on this.
Thanks
Iain

OK, here's the plan:
I already have very basic Data Access Objects (DAOs) for all of the tables in my system. Apart from encoding the most common SQL, the DAO has instance variables for each column in the table, thus implementing a record structure.
So, in my AbstractTableModel, I 'll create a Vector of the DAO, which should give me a sparse array (Vector implements a sparse array, right?) of database records that will be used to hold the rows that have been edited.
The Abstract Data Model's getValueAt( ) method would then be modified to check the cache of edited rows and get the data to display from there for updated rows, and from the ResultSet for non-edited rows.
When it's time to write updates to the database, all I have to do is process the Vector, and destroy it afterwards.
If checking the Vector each time getValueAt( ) is invoked is too expensive, then I could just implement a standard array of booleans. I'll need to keep track of rows to be inserted and deleted too, so an array of ints might be better.
This seems like a good idea to me, but I have no idea if it's gonna work....

Similar Messages

  • Can I use iphoto on ipad app and synch changes back to my mac?

    can I use iphoto on ipad app and synch changes back to my mac?

    No, changes done on the iPad will not sync back to iPhoto on your mac.
    But you can transfer the edited photos back to your mac - share them to the camera role or send them by mail. Any edited image you add to the camera roll can be imported into your iPhoto Library, when you connect your iPad to yourmac via USB.
    But there is no real syncing of iPhoto libraries on your mac and IOS devices.
    Regards
    Léonie

  • I downloaded an upgrade to my adobe reader today, and ever since my search engine has switched to yahoo and wont change back to google. I have a macbook pro, help please? Does anyone know how I can change this back? I have tried through my settings but it

    I downloaded an upgrade to my adobe reader today, and ever since my search engine has switched to yahoo and wont change back to google. I have a macbook pro, help please? Does anyone know how I can change this back? I have tried through my settings but it doesnt work

    Hi Timia,
    If you are using Safari as a web browser :-
    Open Safari, go to Safari menu > Preferences > General, and put Google as the homepage. Then, choose Google as your default search engine.
    If you are using Google Chrome as the web browser :-
      Open Google Chrome.
      In the top right corner of the page, click the Chrome menu Chrome menu > Settings.
      In the "Search" section, select Google from the drop-down menu.
    Let me know if you still experience any issue.
    Regards,
    Aadesh

  • Can I import word for mac document, edit it, and convert it back to word?

    can I import word for mac document, edit it, and convert it back to word?

    Yes, with some caveats.
    Pages and Word do some things differently, so no guarrantees for anything. Mostly it works fine.
    Peter

  • ORacle 10g - Display database data, edit it and write back to database

    Hi!
    I would like to find an application which allows me to read data from a database (object-relational database schema), display it visually, make it editable and offer me the opportunity to write changed data to the database.
    Does anyone have experience with Visio or some other tool?
    Timo

    Hi,
    thank you for your replies!
    I am not sure if the mentioned applications really are what I am looking for. It seems to me that they are developing tools rather than presentation and editing tools. I don't want to present or change the schema but the data of the database. The objects in my database are business processes and the user should be able to get all the information he/she desires about them, be able to edit them and also to create new processes. It's more like a GUI for end users.
    Timo

  • JEST table and status change document OPL8

    Hi Experts,
    1. I created a prod order and released it and saved. went to AUFK and got the object number to pass in JEST  table. System shows no values found.I was expecting a record for the same. do I need to do something to populate JEST table?
    2. In OPL8 under implementation tab, there is something called status change documents. do I need to configure OCM to use these change documents? if the answer is no, then what is the difference between these change documents and OCM change documents?
    thx in advance

    swathi.rege wrote:
    2. In OPL8 under implementation tab, there is something called status change documents. do I need to configure OCM to use these change documents? if the answer is no, then what is the difference between these change documents and OCM change
    The settings in OPL8 will just determine if system should write the change logs of status to table tables CDHDR and CDPOS (for audit trail). Entries will appear here CO03 >> Header >> Status changes
    I think you opened up different windows of different boxes (DEV, QAS etc) and probably created in production order in DEV and checking status in QAS.
    Edited by: Jeevan Sagar on Feb 12, 2012 10:09 PM

  • Keynote and Pages show unknown error editing tables and charts

    It is about 2 weeks that I am unable to edit charts and tables in both Keynote '09 and Pages '09 via the information panel. Adding a table or chart causes an unkown error without crashing the entire program but restricting editing both object types with the implemented attributes covered at the bottom of the application's task bar.
    I am running the lastest versions and OS. Deleting the plist files or font repair doesn't change anything to the situation.
    Someone else experiencing this phenomenon and may found a solution?

    Hi Kyn,
    By right click i assume you refer to ctrl key and click.
    The option Show Package Contents does NOT show.
    Duplicating the file and making a zip does not reveal more either.
    And yes, i saved the docs and copy them to a pen drive to copy in other mac.
    hv done that almost weekly since iwork came out. There were no problems before.
    Are the pndrives in fault?
    Thanks for your help.
    Rgds
    lorenzo

  • Help!! UIX Editable Table and RowID

    I Have UIX with Editable Table:
    <switcher childName="${uix.current.PatrRowID.inputValue == bindings.PatrRowID.inputValue ? 'selected' : 'notselected'}">
    <case name="selected">
    <textInput model="${bindings.PatrCode}" columns="10" readOnly="false"/>
    </case>
    <case name="notselected">
    <textInput model="${uix.current.PatrCode}" columns="10" readOnly="true"/>
    </case>
    </switcher>
    whenn i update colum , i have error
    ORA-00904: "PATR_ROW_ID"
    i have EO with RowID column..

    The new "Create" has also another issues - I am not able to use getCurrentRow in ViewObject. Workaround is to use old 40 behaviour but I think that such big change should be much more documented and because developer sometimes needs to use the 40 behaviour it should be shown in the DataControl. Any comments?

  • HOW TO RETRIEVE A LONG RAW COLUMN FROM A TABLE AND WRITE TO OS FILE

    Good evening.
    Please how can I read a long raw datatype from a table and insert into an operating system file using PL/SQL.
    Thank you.

    What does this have to do with LONG RAW? It is about UTL_FILE and not especially great code.
    The question is how to retrieve and write LONG RAW and that is quite a different matter.
    First you must convert it to BLOB.
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:13213885403654
    Then you can write it out to the file system
    http://www.morganslibrary.org/reference/utl_file.html
    Look at the "Extract Blob" demo

  • Uploading CSV File into Web Dynpro Java Table and Write back to a Database

    Hi Gurus!
    I would like to upload a csv file and read the content into an UI table element.
    Then, I need to write the uploaded file back to a database. I'm using NetWeaver 2004s.
    could you please provide advice for both, uploading and wirting to databse (e.g. maxDB or oracle), since I'm quite new in WDJ.
    thanks in advance.
    farid
    ps. helpfull answers will be rewarded with points!

    Hi ,
    have look at this blog
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/6603. [original link is broken] [original link is broken] [original link is broken]
    Have a look at this links.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00062266-3aa9-2910-d485-f1088c3a4d71.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c0d9336b-b4cf-2910-bdbf-b00d89bd2929.
    Re: Popup Internal Window - data type IWDWindow not available
    Regards,
    krishna.

  • Problem in editing  the table and again saving back to database through web

    hi ,
    i have created ztable and sucessfully able to display through webdynpro but my requirement is that the user should be able to select any of the record n that should be editable and after that the editable data should be saved again to data database .
    i have also alv components in methods of a view
    Create component usage for alv component
      data: l_ref_cmp_usage type ref to if_wd_component_usage.
      l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ). >>>>>>errror
      if l_ref_cmp_usage->has_active_component( ) is initial.
        l_ref_cmp_usage->create_component( ).
      endif.
    Get config model
      data: l_ref_interfacecontroller type ref to iwci_salv_wd_table .
      l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).>>>>>error
      data: l_value type ref to cl_salv_wd_config_table.
      l_value = l_ref_interfacecontroller->get_model( ).
    set visible row count
    l_value->if_salv_wd_table_settings~set_visible_row_count( '5' ).
    Sort rows by seatsocc descending
    data: lr_field  type ref to cl_salv_wd_field.
    lr_field =
       l_value->if_salv_wd_field_settings~get_field( 'SEATSOCC' ).
    lr_field->if_salv_wd_sort~create_sort_rule( sort_order =
       if_salv_wd_c_sort=>sort_order_descending ).
    Display icon in column seatsocc
      data: lr_column type ref to cl_salv_wd_column,
            lr_image     type ref to cl_salv_wd_uie_image,
            lv_icon      type string.                           "#EC NEEDED
      lr_column = l_value->if_salv_wd_column_settings~get_column(
    'SEATSOCC'
      create object lr_image.
      lr_image->set_source_fieldname( 'STATUS' ).
      lr_column->set_cell_editor( lr_image ).              "Display traffic
    *light images in column 'SEATSOCCC'
    delete column STATUS
    l_value->if_salv_wd_column_settings~delete_column( 'STATUS' ).
    set cell editor for input fields (~make colum PRICE editable)
    DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
    lr_input_field TYPE REF TO cl_salv_wd_uie_input_field.
    lr_column_settings ?= l_value.
    lr_column = lr_column_settings->get_column( 'MATERIAL' ).
    CREATE OBJECT lr_input_field EXPORTING value_fieldname = 'MATERIAL'.
    lr_column->set_cell_editor( lr_input_field ).
    data: lr_table_settings type ref to if_salv_wd_table_settings.
    lr_table_settings ?= l_value.
    lr_table_settings->set_read_only( abap_false ).
    here in the code >>>error i have marked  it is saying that the method  wd_cpuse_alv  is unknown even with the method wd_cpifc_alv, firstly iam uable to edit the fields , ater that i can go futher , plz give me the step by step solution as iam new to it

    Hi shaik,
        I couldn't find any problem in the code.
    Whether that is the first method you are initializing the alv model?
    Try this, Comment the whole code in that method. Activate the whole component including views and then uncomment the code.
    Regards...
    Arun.

  • Overage Fees - Upgrade Plan and then change back for only $20 - and no change to contract?

    I am on the Nationwide 700 minute family plan with two lines and finally on a month to month contract.  Just saw on my account that I am over my allowance by 67 minutes ($30.15) and I still have five days until my billing cycle ends.  
    I called VzWireless and the lady on the phone said that there is a way to minimize the overage expense this one time.  According to her, if I "upgrade" my voice plan to the 1400 minute plan before the 21st of the month I will end up not having to pay any overage fees on the peak hours (at least $30 as of writing this with five days to go) and would only have to pay the difference in plans which works out to be an extra $20.  She also said she could "future date" an order to move my plan back to my normal 700 minutes after the bill is issued on the 21st so that I would not have to maintain the more expensive plan.
    Frankly, this sounds too good to be true -  I mean why wouldn't every Tom, Dick, and Harry that goes over on their minutes do this then?  Maybe I am the only person who has not figured this out?  The whole reason I am over on minutes this month is because I got caught in a Directv/U-Verse teaser scam and had to call each company's customer support lines and ended up on hold for hours!  Needless to say I am skeptical...
    Is there any merit to this?  Is it true that I can change my plan without renewing to another two year contract?  Are there hidden fees? Can I trust Verizon?  

    Yes, this is true.
    You can change your plan to the 1400 minute plan prior to the end of your billing cycle. Just make sure that this change is "backdated" to the beginning of the billing cycle you are currently in, so that you have those 1400 minutes available to you for this entire cycle. You will then not go over your allowance.
    After your current billing cycle ends, you can change your minute plan back to the 700 min plan.
    I don't know if I would want the CS rep to do both changes at the same time, as this leads to more likely of a mixup which may impact you in a negative way. Might be better to do one at a time.
    Edit: This practice has been around for awhile. Unlike you, several people who have this service pointed out just like to complain that Verizon should just do this without being asked so that they would never incur overages. Those same people would then just complain that their bill increased without them giving permission to increase their minute allowance.

  • Pages '08 crashes while trying to edit tables and charts

    Pages '08 crashes if I try to edit the contents of a cell in a table or if I try to edit charts. It only happens while editing not copy-pasting data.

    I had the same problem on Ipad Pages. I copied the entire document and pasted it into a newly created Ipad Pages doc and so far it is working again. Good luck.

  • How do I read from one table and write to another identical table?

    I am very new to Oracle. I am trying to do something that should be very simple.
    I am trying to read from one table in SQL and then write to another
    Identically formatted table. I keep getting various errors. Could someone please
    post some vey simple code that will work so that I can play around with it?
    Any help would be greatly appreciated.
    Thanks,
    Ron

    Thanks, but I must be missing something.
    I have two tables, SONGLIST and SETLIST.
    The second line by itself works just fine on either table.
    Here is the code I used following your seggestion, along with it's error message.
    Hope you can help. Thanks again...
    INSERT INTO SETLIST
    SELECT TITLE FROM SONGLIST WHERE ROTATION <> 'X'
    ORA-00947: not enough values

  • What is the best way to edit photos and save changes across devices (without using iphoto)

    So I took allot of vacation photos with my iphone and created a photo stream so they can be viewed across devices. Some are dark and I would like to lighten them up and have the changes saved across devices. What is the best way? I originally tried saving all photos to my pc, editing them them, then syncing to all devices via my pc but, this creates 2 folders on my phone, the actual folder with said vacation name and a folder titled "photo gallery" with the exact same photo's. Not sure why it does that.
    Any suggestions?

    All photos transferred from your computer are saved in the iPhone's Photo Library. The photos in the album or albums below include a pointer only to the original photos stored in the Photo Library. The photos are not duplicated as in taking double the storage space.
    This way you can view the photos in an album only by selecting the album, or all photos in all albums by selecting Photo Library. The same applies if you transfer multiple albums or folders of photos, or a single album or folder.
    Similar to an iTunes playlist on your iPhone. You can listen to a playlist only by selecting the playlist, or listen to all songs by selecting Music. A song placed in a playlist is not duplicated as in taking up double the storage space.
    You can place the edits in the photo stream on your computer, or in the photo stream on your iPhone or other iOS device, and delete the originals in the photo stream prior to the editing.  

Maybe you are looking for

  • Move songs from iPod to new computer

    Ok so my computer's hard drive recently just crashed and since then I've had to replace it, thus meaning everything I had on it is gone. This includes my 3000+ songs on my iTunes. I was wondering if there was any way I could load the songs from my iP

  • [svn:bz-trunk] 23129: change the TomcatLogin interface to cover principal converting.

    Revision: 23129 Revision: 23129 Author:   [email protected] Date:     2011-10-26 08:55:54 -0700 (Wed, 26 Oct 2011) Log Message: change the TomcatLogin interface to cover principal converting. revert the PrincipalConverter interface (stay in core and

  • Mozilla product syncs

    How can I sync Mozilla Thunderbird, Firefox, Lightening and Sunbird on XP home with Tungsten E2?

  • Why there's no Apple Store in Portugal?

    We could see one open! It makes no sense to have like 10 in Spain and none in Portugal!

  • Windows 8.1 update messed up premiere elements?

    I (unfortunately) updated to windows 8.1 yesterday, and my editor got messed up. I usually run windows 8.0 together with premiere elements 9.0 with no problems, but now the layout/graphics of the timeline is messed up everytime I drag a clip to it (y