A question about table model

I created a table model and use JTable to display content of a database's table with that model.
The problem is: when I update a data to data1 in a cell (first column) and hightlight another cell (second column), all cells of first column change content to data1. What 's the problem with my table model?
import java.util.Vector;
import java.sql.*;
import javax.swing.table.AbstractTableModel;
public class CommonTableModel extends AbstractTableModel {
String[] columnNames;
Vector          rows, newRow;
ResultSetMetaData metaData;
private boolean editable;
public CommonTableModel(ResultSet rs, boolean editable) {
this.editable = editable;
try {
metaData = rs.getMetaData();
int numberOfColumns = metaData.getColumnCount();
columnNames = new String[numberOfColumns];
for(int column = 0; column < numberOfColumns; column++) {
columnNames[column] = metaData.getColumnName(column+1);
rows = new Vector();
newRow = new Vector();
while (rs.next()) {
for (int i = 1; i <= getColumnCount(); i++) {
     newRow.addElement(rs.getObject(i));
rows.addElement(newRow);
} catch (SQLException ex) { System.err.println(ex);}
public int getColumnCount() { return columnNames.length; }
public int getRowCount() { return rows.size();}
public String getColumnName(int column) { return columnNames[column];}
public Object getValueAt(int row, int column) {
     newRow = (Vector)rows.elementAt(row);
     return newRow.elementAt(column);
public Class getColumnClass(int column) {
     return getValueAt(0, column).getClass();
public boolean isCellEditable(int row, int column) {
     if (column == 0) { return false; }
     return editable;
public void setValueAt(Object value, int row, int column) {
     newRow = (Vector)(rows.elementAt(row));
     newRow.setElementAt(value, column);
     fireTableCellUpdated(row, column);
}

Try this :
rows = new Vector();
//newRow = new Vector();
while (rs.next()) {
    newRow = new Vector(); // it must be here
    for (int i = 1; i <= getColumnCount(); i++) {
        newRow.addElement(rs.getObject(i));
    rows.addElement(newRow);
}Denis

Similar Messages

  • Question about table compression

    I administer several 10g databases, and have been asked to compress tables in several tablespaces. I am unfamiliar with using compression. I have read some Oracle documentation on the ALTER TABLE... MOVE COMPRESSION command, but still have several questions. Can anyone recommend a good white paper, or other documentation on how best to compress tables with existing data? Thank you in advance for your guidance!

    Basically, I have questions about how to select which tables will benefit from compression. I also read somewhere that, once a table has been compressed, new updates to the compressed data will not be compressed and so I will need to re-compress the tables periodically.
    I also needed to know if the ALTER TABLE statement will compress the existing data or just future inserted data. Through further research I found that by using the MOVE clause, it will compress the existing data. I will also need to rebuild the indexes once the ALTER TABLE statement is complete.
    Thank you for your help and encouragement!

  • Question about table DR$FND_LOBS_CTX$I

    All,
    I have questions about this table 'DR$FND_LOBS_CTX$I'
    1. What's the purpose of this table?
    2. Can we purge this table? How?
    3. Is there any harmful if purge this table?
    Thanks,
    Jackie

    I have questions about this table 'DR$FND_LOBS_CTX$I'
    1. What's the purpose of this table?There is no description about this table in MOS or eTRM -- http://etrm.oracle.com/pls/et1211d9/etrm_pnav.show_object?c_name=DR$FND_LOBS_CTX$I&c_owner=APPLSYS&c_type=TABLE
    You may also check the code in $FND_TOP/sql/aflobbld.sql
    2. Can we purge this table? How?
    3. Is there any harmful if purge this table?Please see these docs/links.
    FND_LOBS_CTX Is Having Huge Size, How To Reduce The Size Of The Index [ID 396803.1]
    http://oracle-apps-dba.blogspot.com/2008/07/how-to-enable-fndhelp-search-by.html
    If you could not find complete answers to your questions, I would suggest you log a SR.
    Thanks,
    Hussein

  • Simple question about table structure and HR in BW

    i need to following data from HR:
    current FTE, employee number, cost place
    i dont think the current FTE is stored per employee. Therefor is would need a list that contains:
    mutation start date, mutation end date, FTE, employee, cost place
    i think cost place is a custom field.
    my question : what tables names and field names do i need?
    Thanks in advanced

    Hi,
    For Head Count you can use 0HR_PA_0 datasource and the other Employee details like start date and end date you can get them from employee master data and FTE can be calculated from the Emloyee Master Data and Head count data.
    Hope this helps...
    Thanks,

  • WebAPI question about Hierarchy modeling

    Hi all,
    I have come to a issue about Hierarchy modeling. I want to use WebAPI to drill down the query in the visual composer. And I have follow every steps mentioned in this PDF file
    </people/prakash.darji/blog/2006/08/24/overcome-limitations-around-using-bi-hierarchies-in-vc-by-using-ui-elements-from-wad
    Here is my webapi:
    'FILTER_NODE_IOBJNM=0COUNTRY;FILTER_VALUE='&@Country_key&';FILTER_COLLAPSE= ;FILTER_IOBJNM=0COUNTRY;
    CMD_1=CMD%3DDRILL_TO_LEVEL%26LEVEL%3D2%26IOBJNM%3D0COUNTRY%26DATA_PROVIDER%3DDP;'
    It's really same to the webapi in the PDF file except the different characteristic. and my model structrue is also the same as that one. And I has also confirmed the displaying hierarchy is checked in the query.
    The issue is that the "drill to level" part of the webapi works well, but the filter doesn't work. I have no idea why. Can anyone help me?
    Regards,
    Dicky

    Dicky,
    I struggled with this for 3 days, I understand your pain. After a deep investigation I found that my mapping was incorrect. Try this:
    1) Double click on DRILLDOWN connection between output and input ports
    2) Check if WEBAPI inputfield has the web api commands
    3) Make sure that none of the other input fields have values set. It usually happens that when you connect the output to the input port, similar (or like) variables are mapped automatically, for example in my case, I had Org_unit mapped to @Org_unit automatically. Delete such mappings. You should have only the WEBAPI input field with an assigned value.
    Hope this helps,
    Kiran

  • Question about Table Locks

    Hi All,
    Is there any Oracle defined table/place from where we can know the details about Tables that have been locked in the current session?
    Thank you.

    Hi ,
    To know which all objects are locked, you can use the below query :-
    COLUMN owner FORMAT A20
    COLUMN username FORMAT A20
    COLUMN object_owner FORMAT A20
    COLUMN object_name FORMAT A30
    COLUMN locked_mode FORMAT A15
    SELECT b.session_id AS sid,
           NVL(b.oracle_username, '(oracle)') AS username,
           a.owner AS object_owner,
           a.object_name,
           Decode(b.locked_mode, 0, 'None',
                                 1, 'Null (NULL)',
                                 2, 'Row-S (SS)',
                                 3, 'Row-X (SX)',
                                 4, 'Share (S)',
                                 5, 'S/Row-X (SSX)',
                                 6, 'Exclusive (X)',
                                 b.locked_mode) locked_mode,
           b.os_user_name
    FROM   dba_objects a,
           v$locked_object b
    WHERE  a.object_id = b.object_id
    ORDER BY 1, 2, 3, 4;Anand

  • A question about conversion model.

    I'm programming a JSF-based forum. See the code below:
    <jsp:useBean id="CommentBean" class="net.gleamynode.notes.http.faces.CommentBean" scope="request" />
    <jsp:setProperty name="CommentBean" property="pageId" value="${p.id}"/>
    <h:form id="commmentForm" formName="commentForm" >
    <h:input_hidden id="pageId" valueRef="CommentBean.pageId"/>
    <h:input_text id="userName" valueRef="CommentBean.userName"/>
    <h:input_text id="userEmail" valueRef="CommentBean.userEmail"/>
    <h:input_text id="userURL" valueRef="CommentBean.userURL"/>
    <h:input_textarea id="content" valueRef="CommentBean.content"/>
    <h:command_button id="submit" label="Leave a comment" commandName="submit" actionRef="CommentBean.createAction" />
    </h:form>
    The type of CommentBean.pageId property is 'java.lang.Integer'. It seems JSF does not convert the request parameter 'pageId' (whose type is String) properly. CommentBean.pageId is always set to '0'.
    The strange fact is that it works if I use input_number instead of input_hidden! It is clear that the conversion model is applied differently for different component types. (Sorry, I did'nt have much time to read every chapter of the spec. ;)
    Is there anyone who experienced the same problem?
    PS: btw, the first two line in the code above looks very unnatural because we specified the name of the bean class and scope already in faces-config.xml. Is there any way to do the same job without using jsp:useBean and jsp:setProperty? (please note ${p} is not a managed bean. it is just a dynamically declared bean in page scope.)

    Hi,
    yes, it seems, that input_hidden field accepts only String attributes.
    But this (maybe) will be changed in next releases so no conversion should be necessary.
    See, what Craig said about a similar case, which I think includes your question: http://forum.java.sun.com/thread.jsp?forum=427&thread=443816&message=2011411#2011411
    Greetings,
    Rene

  • Question About Table Style Terminology

    I am curious about what other people might call the following two styles of table construction.
    Style 1:
    create table cust_trans_a (
        cust_nbr                varchar2(6),
        trans_date             date,
        sales                      number(11, 2)
    Style 2:
    create table cust_trans_2 (
        cust_nbr                varchar2(6),
        sales_in_2004,
        sales_in_2005,
        sales_in_2006,
        sales_in_2007   
    );I have been using the terms vertical and horizontal respectively for these two construction styles, but I would like to know if other DB professionals have another, more descriptive set of terms for them.
    Thanks,
    Gregory

    How about normalized and denormalized?
    Generally, denormalized data models (Style 2) are a pain to deal with because you're constantly having to add columns (i.e. you'll eventually want to store 2008 sales) and because you have to maintain the same information in both summary and detail tables. In Oracle, if you think you need a denormalized table, you're generally better off creating a materialized view instead.
    Justin

  • Question about Tables in iWeb

    Having read previous posts, I understand that tables can be made one of two ways for use in iWeb: (1) Create them in Pages or Keynote and paste them in or (2) create HTML code and use the HTML snippit widget.
    The problem I see with the first method is that the table, based upon my experimentation, are seen in iWeb as a graphic. So there's no real way to control something like print size, for instance.
    The problem with the second method is that an HTML snippit cannot be inserted within a textbox. So if a person's browser is rending text differently than I have set up a page in iWeb, text could potentially overlap the table.
    Therefore, to put a table in the middle of text, it would seem preferable to create the table in Pages or Keynote.
    So here's my question, assuming the above is correct--is there any way for a table pasted from Pages or Keynote to be treated as any other way than a graphic? I'm still concerned about text size in the graphic not matching text size on the page with all the various browsers and browser settings. I realize that this method won't create overlapping text, but it would seem that there's great potential for the table to not match the body text.

    I know that iWeb creates them in HTML. I am a little more familiar with web pages than what I my post probably let you believe. I guess what I was curious about was the way in which Apple archives the news and turns it into an RSS feed. I've tried playing around with Safari, and viewing other RSS feeds, but I have not come across a way to print multiple RSS feeds at once.
    I guess what I am trying to get around is printing all of the pages individually, since as you could imagine that would equate to a ton of paper since I would be working about 3-4 days per week x 32 weeks (8 months). So you are talking about 96-128 pages of entries.
    Could you recommend any shortcuts for trying to do what I am trying to do, even if it doesn't involve iWeb? (I do have access to another domain with PHP scripting and a mySQL database if you have suggestions)

  • Creating SAP QUERY - question about tables in buisness transactions.

    Hello.
    I am pretty new to SAP.
    I want to create a query, as i so far have successfully done by creating a join in transaction SQVI.
    I am useing several tables;
    CRMD_ORDERADM_H
    CRMD_ORDERADM_I
    CRMD_ORDER_INDEX
    I have two questions.
    1: I try to join CRMD_ORDER_INDEX-PARTNER_NO with BUT000-PARTNER, but it won't do the trick. After a join like this i would like to join BUT000 with ADRC . Can someone explain how i could do this?
    2: I want join CRMD_ORDERADM_I with all the partners for the specific Item. (sold-to-party, shipping-party and so on). Can anyone tell me which table(s) i can find this in, and what fields to join.
    I will appreciate any answer to this

    Hi,
    For the second question, enter your transaction number ( Object ID ) into <b>CRMD_ORDERADM_H</b>  table. Pass the guid to table <b>CRMD_LINK.</b>
    Take set guid from CRMD_LINK and pass it to <b>CRMD_PARTNER</b>.
    You will get all the partners in that transaction
    regards,
    Prashant
    <b>Kindly Reward the points if helpful !</b>

  • Question about table partitioning...

    Hello, all.  I'm using SQL 2012 Enterprise.  I have 8 very large tables (the largest two having 227M and 118M records, and the others between 11M-44M records).  For performance reasons, I'm considering partitioning the tables across multiple
    files/filegroups.  For my largest table (227M records), the data is spread across years 2011, 2012, and 2013 with 2013 having 104M records.  So naturally I'm considering partitioning on a Date column.  My question is should I go with four partitions
    (2011, 2012, 2013 and 2014 for new data) and still end up with a very large aggregation of data on the 2013 partition (104M) or should I further breakdown the 2013 partition into months now having 12 partitions for 2013 alone, and then I'm OK with all
    of 2011 and 2012 on their own partitions.  Again, this is for one table.  I'd still like to partition the other 7 large tables.  In the end, I could end up with many, many partitions and hence many, many filegroups.  I'm interested in how
    others partition MULTIPLE large tables.  Can you share partition functions/schemes across tables?
    Any thoughts, your own personal experiences, etc would be greatly appreciated.  Also, can someone recommend a good book, article, blog, etc on partitioning large databases.
    Thanks much in advance.
    Roz

    If you query against more than one partition I have doubts  you will gain performance...
    -- Create partition functions
    CREATE PARTITION FUNCTION PF1(INT) AS RANGE RIGHT FOR VALUES (1, 2, 3);
    CREATE PARTITION FUNCTION PF2(INT) AS RANGE RIGHT FOR VALUES (1, 2);
    -- Create filegroups
    ALTER DATABASE testdb ADD FILEGROUP FG7;
    ALTER DATABASE testdb ADD FILEGROUP FG6;
    ALTER DATABASE testdb ADD FILEGROUP FG5;
    ALTER DATABASE testdb ADD FILEGROUP FG4;
    ALTER DATABASE testdb ADD FILEGROUP FG3;
    ALTER DATABASE testdb ADD FILEGROUP FG2;
    ALTER DATABASE testdb ADD FILEGROUP FG1;
    -- Create partition schemes
    CREATE PARTITION SCHEME PS1 AS PARTITION PF1
    TO (FG1, FG2, FG3, FG4);
    CREATE PARTITION SCHEME PS2 AS PARTITION PF2
    TO (FG5, FG6, FG7);
    CREATE VIEW [dbo].[partition_info] 
    AS
    SELECT
    DB_NAME() AS 'DatabaseName'
    ,OBJECT_NAME(p.OBJECT_ID) AS 'TableName'
    ,p.index_id AS 'IndexId'
    ,CASE
    WHEN p.index_id = 0 THEN 'HEAP'
    ELSE i.name
    END AS 'IndexName'
    ,p.partition_number AS 'PartitionNumber'
    ,prv_left.value AS 'LowerBoundary'
    ,prv_right.value AS 'UpperBoundary'
    ,ps.name as PartitionScheme
    ,pf.name as PartitionFunction
    ,CASE
    WHEN fg.name IS NULL THEN ds.name
    ELSE fg.name
    END AS 'FileGroupName'
    ,CAST(p.used_page_count * 0.0078125 AS NUMERIC(18,2)) AS 'UsedPages_MB'
    ,CAST(p.in_row_data_page_count * 0.0078125 AS NUMERIC(18,2)) AS 'DataPages_MB'
    ,CAST(p.reserved_page_count * 0.0078125 AS NUMERIC(18,2)) AS 'ReservedPages_MB'
    ,CASE
    WHEN p.index_id IN (0,1) THEN p.row_count
    ELSE 0
    END AS 'RowCount'
    ,CASE
    WHEN p.index_id IN (0,1) THEN 'data'
    ELSE 'index'
    END 'Type'
    FROM sys.dm_db_partition_stats p
    INNER JOIN sys.indexes i
    ON i.OBJECT_ID = p.OBJECT_ID AND i.index_id = p.index_id
    INNER JOIN sys.data_spaces ds
    ON ds.data_space_id = i.data_space_id
    LEFT OUTER JOIN sys.partition_schemes ps
    ON ps.data_space_id = i.data_space_id
    LEFT OUTER JOIN sys.partition_functions pf
    ON ps.function_id = pf.function_id
    LEFT OUTER JOIN sys.destination_data_spaces dds
    ON dds.partition_scheme_id = ps.data_space_id
    AND dds.destination_id = p.partition_number
    LEFT OUTER JOIN sys.filegroups fg
    ON fg.data_space_id = dds.data_space_id
    LEFT OUTER JOIN sys.partition_range_values prv_right
    ON prv_right.function_id = ps.function_id
    AND prv_right.boundary_id = p.partition_number
    LEFT OUTER JOIN sys.partition_range_values prv_left
    ON prv_left.function_id = ps.function_id
    AND prv_left.boundary_id = p.partition_number - 1
    WHERE
    OBJECTPROPERTY(p.OBJECT_ID, 'ISMSSHipped') = 0
    AND p.index_id IN (0,1)
    GO
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Question about table strucuture

    Hello Gurus,
           I have following two questions:
        (1) how can I know what is the key field for a table ?
        (2) in SE80, when I display the structure of a table, there are component type and data type , why does here have two different types? ( apparently, there values are differenct)
    thanks very much!

    Hi,
        1) Go to t.code 'SE11'
            enter the table name and display.
             there the key checkbox is enabled.this the primary key field.
            If the checkbox is not enabled then it is a non key field.
      2) In structure,
             Component type refers the data element.
              Datatype refers type of the field that is wheather it is char,int etc.,
    Thank u,
    Manjula Devi.D

  • Question about table COEP

    Hi SAP Expert and Guru,
    Currently I am gathering the Invoice Document Number from Project ID and below is my table flow.
    Project ID/ WBS is being inserted to table PRPS-PSPHI,
    Then the Object Number from PRPS-OBJNR is being captured and being used in table COEP-OBJNR to derive the value in COEP-BELNR.
    Later the value in COEP-BELNR is being used in table COBK-BELNR to derive the invoice number in COBK-REFBN.
    My question now is, is there any other table that we can use to replace table COEP, in order to get the Object Number OBJNR linked up with the Document Number BELNR which can be used in table COBK to derive the Invoice Number.
    Kindly Advise and consult.
    Thank you
    Regards
    Leonard Tan

    Why dont you try to use the OBJNR from PRPS and use it in the COFP table?
    I think you should be able to get the details you are looking for.
    Let us know if it helps.

  • Question about Tables:  Urgent

    Hi, I'm trying to create a table inside BW.  The objective is to create this table so that an Oracle Administrator can "Push" or "drop" data into this table in BW.  I'm currently using 2004s, so I am having quite a hard time....  What are the sequence of steps required in creating this table with the end goal of activating it so that it can be "seen" and used...  How do I activate the table?  Do I need to generate a datasource for this?  If I do, what are the sequence of steps that I need to do for this?  Much thanks....
    - Beleaguered B.I.

    Philips:
    A. Assuming that I have successfully created a table in B.I. 7, how will I check to
    ensure that the table that I just created exists in the system? What are the
    sequence of steps to doing this check? Will the administrator on the Oracle
    side (see original question) be able to "see" this table?
    When you activate the table, go to transaction Se16 and put your tablename and press f8, if the table is not active, you will get a mesage. This is a initial check.
    When you create a transparant table in SAP, SAP creates automatically created a table in the database underlying. Thats why it is called transparent table.
    YES. youur administrator can see the table with a SQL statement desc TABLE in the database layer.
    B. Assuming that I successfully created a DataSource, how can i check to ensure
    that the DataSource is indeed active and is in the System? What are the
    sequence of steps to achieving this?
    The last step in creating data source is to save / generate. Once generated, you can see the data source in RSA3. Run RSA3 and give the data source name and press f8, you will see the result.,
    C. Is there a particular methodology or standard as to how I should create a table?
    Can you point me out to a documentation or link to a "HOW TO" in creating
    tables? Where exactly in the BI 7 system are the tables store.
    To create a table you need something called developer key which is a long string of numbers. Check with your basis administrators and they will generate the key for you.
    Once you have this, decide the structure of your table and we will take it from there.
    Ravi Thothadri

  • CS2......Questions about tables

    Can you choose to delete the rows or colums you want for a table you've made in In Design or by default, it will delete the bottom ones and the one at your right.
    I know I can do it in Quark, but I'm thinking about leaving quark for In Design and I have a lot of table to redo....it's a catalogue.
    Thanks for youy help!

    Of course you can, and if you've got alternating rows and fills, the
    table will automatically adjust.
    Just select the row and right click. From the contextual menu choose
    delete > row.
    Bob

Maybe you are looking for

  • I_UPDMODE has no value in my Function Module when using Delta Extraction

    Help me please. My system is BW 3.52 Please see the source code below and tell me why I_UPDMODE has not been passed value. I have ever used "I_SOURCE" but the value pass to I_DSOURCE. Can anyone tell me where is the upload mode pass to? FUNCTION ZBWF

  • Error ORA-00980: synonym translation is no longer valid when i issue

    i accidentally drop one of my table. To bring it back i used Imp tool. But it gives an error ORA-00980: synonym translation is no longer valid when i issue Select * from ship_sched_fact_notice_det Action taken using Imp Username: erpdada Password: Co

  • Customer service Order settlement

    Resource related billing. I created a Service Order. I finished all the steps from Create Order to Billing VF01. Next Service Order Settlement. I did not activate Profitability. I freezed the settlement profiles and allocation structure. I configured

  • Attachment to Mail step in workflow

    Hi All      I have to create a attachment to the standard mail step , for that i have created a object of type SOFM and sent it back to the workflow conatiner ATTACHOBJECTS  and later this element is binded to ATTACHOBJECTS of the mail step conatiner

  • Does this 'crash report' show the cause of the crash?

    Can anyone shed any light on this type of crash (crash report follows) in SAFARI? It seems to keep happening -- crashes to the desktop which generate an error report, or a spinning beach ball crash where the ball never gives up (i.e., I have to reboo