Regarding setValueAt method in JTable

sir,
i have a problem regarding JTable.
now if u enter the data in cell
then setvalueAt() method is called once
now if u enter the data in a cell which is already
having a dat in that cell, then the setvalueAt method
is called twice.........
why it so and how can i prevent it as i needed it in
getting dataVector and when i print the values of dataVactor
it gives recent values not the previuos set values
i m just beginner in this concern
i hope u be able to understand and solve
thanks in advance

Hi,
I have looked at your code. You are still trying to control too much yourself. Let the table do it instead. The table is designed to handle all of its events and works best when you let it. I made a few code suggestions here. I didn't compile it, so please don't expect it to just work. It is merely a suggestion of an approach that may make your work easier.
  Vector tableData = new Vector();
  ArrayList newValues;
  ViewModel ()
    // in the constructor create an ArrayList for each row that will be displayed
    // and put them in the tableData Vector
    int count = newViewFrame.sortCombo.getItemCount(); // Count is the number of rows?
    for(int i=0;i<count;i++)
      newValues = new ArrayList();
      for (int j = 0; j < numColumns; j++)
        newValues.add();
      tableData.add (newValues);
  // These methods are used by the table and should be supplied
  public int getRowCount ()
  { return tableData.size(); }
  public int getColumnCount ()
  { return 5; }   // the number of columns in your table - this number is used a lot
                  // do not make it complicated to compute
  public void setValueAt(Object value,int row, int col)
    //super.setValueAt(value,row,col); - No point, this is an empty method
    // if the index is out of bounds or nothing was changed return
    if (row < 0 || row >= getRowCount())
      return;
    if (o == null)
    { return; }
    // get the data array for the row which was changed 
    newValues = (ArrayList)tableData.elementAt (row);
    // it doesn't look like your are doing anything for columns 1 -4 ?
    if (column == 0)
      return;
    if (column == 1) 
      return
    else if (column == 2)  
      return;
    else if (column == 3)   
      return;
    else if (column == 4) 
      // not first - do this after you have changed the array
      // fireTableChanged(new TableModelEvent(this,0,4,4));
      Integer colValues[] = TableComboBoxEditor.getColumnValues(((ViewModel)newViewFrame.viewTable.getModel()).getDataVector(),col);
      int retrunValue = alreadyExists(colValues , value);
      System.out.println("the value of row is "+retrunValue);
      if( retrunValue != Integer.MIN_VALUE && retrunValue != row)
        System.out.println("heyheyeheyeheye");
        Set setOfRows = TableComboBoxEditor.hash.keySet();
        Iterator iterator = setOfRows.iterator();
        setValueAtCalled=true;
        int count = newViewFrame.sortCombo.getItemCount();
        // newValues = new ArrayList(); use the one from the dataVector
        for(int i=0;i<count;i++)
          newValues.add(newViewFrame.sortCombo.getItemAt(i));
        // while(iterator.hasNext()){
        // setValueAt(new Integer(0),((Integer)iterator.next()).intValue(),col);
        validatingRemainingColumns(iterator,value,row);
        setValueAtCalled = false;
      // now refresh the table
      fireTableChanged(new TableModelEvent(this,0,4,4));
  // this method creates Integers to set the values in the table
  // If you want Strings instead change it
  public Object getValueAt (int row, int column)
    if (row < 0 || row >= getRowCount())
      return " ";
    newValues = (ArrayList) tableData.elementAt (row);
    if (column == 0)         // set number
      return new Integer (newValues.get(0));
    else if (column == 1)   
      return new Integer (newValues.get(1));
    else if (column == 2)  
      return new Integer (newValues.get(2));
    else if (column == 3)  
      return new Integer (newValues.get(3)));
    else if (column == 4)  
      return new Integer (newValues.get(4)));
    else if (column == 5)  
      return new Integer (newValues.get(5)));
  {\code]

Similar Messages

  • Throwing exceptions in a TableModel setValueAt method?

    I have a TableModel. I would like the setValueAt method to throw an exception if there is an exception.
    The problem is that I cant throw an Exception because the method's signiture does not allow it.!! MoreOver, it is the JTable which will call the method. So if I throw a RuntimeException the GUI crumbles!! I and I cant make the user know about the exception.
    I dont think that it is a good practice to show the error using a JOptionPane inside the setValueAt method!! I want to pass the exception from the tableModel to the User. what is the best practice?!
    thanks..

    Swing related questions should be posted in the Swing forum.
    what is the best practice?!I don't think there is a way to throw an exception. The default editors change the Border color to RED to indicate an error. If you don't want to show an option pane in the setValueAt (I don't believe it belongs there either), then you could add code to the editor to display an option pane as shown in this posting:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=645740

  • Query regarding updating rows in JTable

    Query regarding updating rows in JTable
    Hello,
    I have a JTable with 6 columns and 1000s of rows (which are data read from flat files)
    I can select 1 or more rows and change the values of the
    columns. each time I do this I need to update the values
    in the flat file.
    Currently I assign the updated Jtable values to a vector
    Vector rowVector = (Vector)defaultModel.getDataVector();
    then I iterate over the vector and compare the values with the (old) data
    in the JTable.
                for(int rowCount = 0; rowCount<rowVector.size(); rowCount++){
                    Vector v = (Vector)rowVector.elementAt(rowCount);
                        //smsList is the Vector that contains the old JTable values
                        for(int i=0; i<smsList.size(); i++){
                                //If colums values have been changed; add that
                                //vector value to another vector
                                selectedsmsList.add(smsList.get(i));
                for(int i=0; i<selectedsmsList.size(); i++){
                         //Update the values in the flat file
                }This works fine except that it takes ages to iterate over the updated vecor and un-updated,old vector; is there any way to directly get the list of rows that were updated in the jtable; so that I can directly do an I/O operation to update the jtablke values?

    Just a suggestion.
    You could add a listener and use a vector of booleans to keep track of the rows that have been changed. You could then iterate through this boolean vector and update the changed rows.
    See
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#modelchange
    Don't know whether this will be helpful.
    Regards, Darryl

  • SetValueAt method()

    I have little experience with swing...... can anyone give me a few pointers on how i would insert data in cells in a table and save them to a database. i want to do this using the setValueAt method. i am using a DAO to connect to the database. This is what i have so far.....
    public void setValueAt( Object value, int rowIndex, int colIndex ) {
            BookVO book = (BookVO)this.books.get( rowIndex );
              if ( colIndex == 0 ) book.setIsbn( (String)value );
            else if ( colIndex == 1 ) book.setLastName( (String)value );
            else if ( colIndex == 2 ) book.setFirstName( (String)value );
            else if ( colIndex == 3 ) book.setTitle( (String)value );
            else if ( colIndex == 4 ) book.setPrice( (float)value );
            else if ( colIndex == 5 ) book.setYear( (int)value );
            else if ( colIndex == 6 ) book.setDescription( (String)value );
        }this is the insertBook() in my DAO
    public void insertBook(BookVO book) throws BookDAOException {
            try {
                String sqlCommand =
                    "insert into Books( isbn, lastName, firstName, title, price, year, description ) values ( ?, ?, ?, ?, ?, ?, ? )";
                PreparedStatement stmt = conn.prepareStatement( sqlCommand );
                stmt.setString( 1, book.getIsbn() );
                stmt.setString( 2, book.getLastName() );
                stmt.setString( 3, book.getFirstName() );
                stmt.setString( 4, book.getTitle() );
                stmt.setFloat( 5, book.getPrice() );
                stmt.setShort( 6, book.getYear() );
                stmt.setString( 7, book.getDescription() );
                int rowsAffected = stmt.executeUpdate();
                if ( rowsAffected != 1 ) {
                    throw new BookDAOException( "Error inserting book into database" );
            catch ( SQLException e ) {
                throw new BookDAOException( "SQLException: " + e.getMessage() );

    So... what is the question ?

  • I 'd like to know regarding a method to separate a standby node from CE

    Hi community
    I have a question regarding a method to separate a standby node from CE.
    I would like  to know if it is possible to run the vary off command on standby node while active instance is working.
    For example,
    -shutdown standby instance on standby server.
    -run vary off and exportvg command on standby node while active instance is working.
    Version Info
    -OS : AIX 6.1
    -DBMS : Sybase CE 15.5 with 2Node
    -Shared Volumn : DS8700 ( 4TB )
    In this case, I would like to know if there is any side effect on Active instance.
    Our CE version is ASE15.5 ESD5.3 on AIX.
    Thanks in advance
    Regards
    Taiwoo Kim

    To make sure I understand, you have a two node ASE cluster....one of which is active, the second is idle.   You want to detach (for some reason) the disks from the second node of the cluster.
    From the cluster viewpoint, provided you shutdown the ASE instance on that node and don't run any cluster utilities on that node (e.g. sybcluster, quorumutil, etc.) - then whether the disks are attached or not is likely not going to be an issue.   It would be no difference to the surviving node than if you shutdown the other node completely (host included).
    What concerns me is that you obviously are planning something that affects that volume group - e.g. moving it to a new machine???    Swapping HW???  Updating OS volume management firmware???   If swapping HW, remember, the quorum has the list of participants in the cluster - so unless the new hardware hostname/ipaddr matches the old, you will need to modify the quorum entries (TechSupport can help with this) - although the better approach would be to build a new node of the cluster on the new HW (temporarily a 3 node cluster) and then remove the old node from the cluster.    If updating OS firmware, just be careful that the patch doesn't cause problems with IO fencing by changing the SCSI PGR versions or something.

  • Need Help in JTable setValueAt method()

    hi to all i am new to this forum. i am trying to create user creation using JTable
    Here my code
    import javax.swing.table.*;
    import java.awt.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.TableModelEvent;
    import java.awt.event.*;
    import javax.swing.event.TableModelEvent;
    import javax.swing.event.TableModelListener;
    public class user_table1 extends JDialog implements ActionListener,TableModelListener{
    JTable tab;
    JButton print_but,add_but,rem_but;
    DefaultTableModel md;
        public user_table1() {
            super();
            setLayout(null);
            setTitle("Table Demo...");
             md=new javax.swing.table.DefaultTableModel(
                new Object [][] {
                    {"Dinesh", new Boolean(false),new Boolean(false)},
                    {"Kumar", new Boolean(false),new Boolean(false)},
                new String [] {
                    "user name", "Admin","User Enabled"
                Class[] types = new Class [] {
                    java.lang.String.class, java.lang.Boolean.class,java.lang.Boolean.class
                public Class getColumnClass(int columnIndex) {
                    return types [columnIndex];
            tab=new JTable(md);
            JScrollPane js=new JScrollPane(tab);
            js.setBounds(0,0,500,300);
            print_but=new JButton("Print Data");
            print_but.setBounds(10,400,120,30);
            print_but.addActionListener(this);
            add_but=new JButton("AddNew User");
            add_but.setBounds(140,400,150,30);
            add_but.addActionListener(this);
            rem_but=new JButton("Remove User");
            rem_but.setBounds(320,400,150,30);
            rem_but.addActionListener(this);
            add(js);
            add(print_but);
            add(add_but);
            add(rem_but);
            md.addTableModelListener(this);
            setSize(500,500);
         public void actionPerformed(ActionEvent e) {
           if(e.getSource().equals(print_but))
             int nu=tab.getRowCount();
             int co=tab.getColumnCount();
             for(int i=0;i<nu;i++)
                  for(int j=0;j<co;j++)
                       System.out.print (tab.getModel().getValueAt(i,j)+"\t\t");
                  System.out.println ();
           if(e.getSource().equals(add_but))
            int rowval=tab.getRowCount();
          md.addRow(new Object [][] {{"New User", null}});
            md.setValueAt("New User "+tab.getRowCount()+"",tab.getRowCount()-1,0);
           if(e.getSource().equals(rem_but))
                    if(tab.getSelectedRow()<0)
                     JOptionPane.showMessageDialog(this,"Select User To Remove");
                    else
                           md.removeRow(tab.getSelectedRow());
            public void tableChanged(TableModelEvent e) {
            if(e.getType()==TableModelEvent.UPDATE)
                    System.out.println("Update Row "+tab.getSelectedRow()+"Col :"+tab.getSelectedColumn());                        
                    //System.out.println("New Values.."+md.getValueAt(tab.getSelectedRow(),tab.getSelectedColumn()));
                    if(tab.getSelectedColumn()==1)
                            if(md.getValueAt(tab.getSelectedRow(),tab.getSelectedColumn()).toString().equals("true"))
                                            md.setValueAt(new Boolean(true),tab.getSelectedRow(),2);
        public static void main(String sr[])
        java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    user_table1 dialog = new user_table1();
                    dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                        public void windowClosing(java.awt.event.WindowEvent e) {
                            System.exit(0);
                    dialog.setVisible(true);
    }i need If the user Set as admin then automatically corresponding user Enabled row is set as true
    so i write the following code in
    md.setValueAt(new Boolean(true),tab.getSelectedRow(),2);
    It triggers tableupdate event again and again and prints
    Update Row 0Col :1
    Update Row 0Col :1
    Update Row 0Col :1
    Update Row 0Col :1
    Update Row 0Col :1
    Update Row 0Col :1
    more then 200 times
    and give the exception as
    Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError
    at sun.nio.cs.SingleByteEncoder.encodeArrayLoop(SingleByteEncoder.java:91)
    at sun.nio.cs.SingleByteEncoder.encodeLoop(SingleByteEncoder.java:130)
    at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:544)
    at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:252)
    at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:106)
    at java.io.OutputStreamWriter.write(OutputStreamWriter.java:190)
    at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:111)
    at java.io.PrintStream.write(PrintStream.java:476)
    at java.io.PrintStream.print(PrintStream.java:619)
    at java.io.PrintStream.println(PrintStream.java:756)
    at user_table1.tableChanged(user_table1.java:104)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    at user_table1.tableChanged(user_table1.java:110)
    at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
    at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
    at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:650)
    and again and again repeat exception
    please give solution or example for this problem and some idea to disable UserEnabled column row when corresponding Admin Column row value is true.

    if(e.getType()==TableModelEvent.UPDATE)
                    System.out.println("Update Row "+tab.getSelectedRow()+"Col :"+tab.getSelectedColumn());                        
                    //System.out.println("New Values.."+md.getValueAt(tab.getSelectedRow(),tab.getSelectedColumn()));
                    if(tab.getSelectedColumn()==1)
                            if(md.getValueAt(tab.getSelectedRow(),tab.getSelectedColumn()).toString().equals("true"))
                                            md.setValueAt(new Boolean(true),tab.getSelectedRow(),2);
            }You created an infinite loop. When the selected column is 1, you update a value in column 2, which generates another TableModelEvent. The selected column is still 1, so the column is updated again, which fires another TableModelEvent.
    You should not be checking the selected column. You should be using the row and column from the TableModelEvent to determine which cell was just updated.

  • Regarding get_parameter_field method in webdynpro abap

    Hello Gurus,
    We have a requirement in to prepare selection screen.we are implimenting selection screen with two select options and one parameter using add_selection_field and add_parameter_field methods respectively.now i need these values at runtime.so,ihave used two methods for this are get_range_table_of_sel_field and get_parameter_field .but the method get_parameter_field is not working properly.how can i get parameter value at runtime.this is the correct metod or not to get the parameter value at runtime.
    Could anyone  suggest me solutions?
    could anyone  send me sample code or reference links if possible.
    Thanks in Advance for your replies.
    Regards,
    babu

    Hi Rajasekhar,
    Please go through below wiki. It uses another way to get data from all selection-screen items.
    [Complex Select Option USage|http://wiki.sdn.sap.com/wiki/display/Snippets/WebDynproABAP-Complexselect-optionscomponent+usages]
    I hope it helps.
    Regards,
    Sumit

  • Need some explanations regarding static Method

    Hello,
    I have a code where a class has a static method access by other classes. This not working as I thought and I would like to understand why.
    Here below is the code.
    Here is a class having the static method "test"
    package test;
    public class StaticTest {
        public StaticTest() {
        public static void test (int i){
        while (i < 1000){
            System.out.println("i = " + i );
            i++;
    }Here is the code of another class (Thread) using this static method. This Thread can be initialized with an integrer value that will be passed to the static Method.
    package test;
    public class ThreadTester extends Thread {
        int x;
        public ThreadTester(int i) {
            x=i;
        public void run(){
            StaticTest.test(x);
    }Here is the code starting 2 Thread running in parallel and both are then calling the static method.
    //start 2 thread accessing the static method.
          ThreadTester test1 = new ThreadTester(0);
          ThreadTester test2 = new ThreadTester(200);
          test1.start();
          test2.start();
    ...As the second thread is started with a bigger value I thought that we would only have seen few printouts from the first thread starting by 0 and then printouts starting by 200.
    Here is what I thought regarding the result:
    i = 0
    i = 1
    i = 2
    i = 3
    i = 200 --> startup of the second thread, x in static method is overriden (at least this is what I thought!)
    i = 201
    i = 202
    i = 203
    i = 204
    i = 205
    i = 206
    i = 207
    i = 208
    i = 209
    But the real result is:
    i = 0
    i = 1
    i = 2
    i = 3
    i = 4
    i = 5
    i = 200
    i = 6
    i = 201
    i = 202
    i = 203
    i = 204
    i = 205
    i = 206
    i = 7
    i = 207
    i = 208
    i = 209
    i = 8
    It seems that there is 2 instances running in parallel. I thought that it would'nt be the case with the word "Static".
    Also I don't understand the result because if I use JBuilder in Optimizer mode I can see that there is only one instance of StaticTest object.
    Can anyone here explain me how is that possible?
    Thanks in advance for your help.
    Regards,
    Alain.

    >
    thread test1 creates its own stack and starts incrementing �i� starting at values 0. However, in the middle of incrementing, it gets kicked out by the OS (or JVM) into a �blocked� state to allow other threads to run. BUT before leaving the running state, test1 saves the stack state including the value of �i�.
    >
    Ok, now I understand, but then I have another question.
    What is the difference between the code shown in my first post and the following where we create 2 instances of StaticTest class (which is not static in this case for sure).
    How to decide (while coding) if it is better to use difference instances of class or not?
    package test;
    public class StaticTest {
        public StaticTest() {
        public void test (int i){ //Not static anymore
        while (i < 1000){
            System.out.println("i = " + i );
            i++;
    }We create new instance in the Thread.
    package test;
    public class ThreadTester extends Thread {
        int x;
        public ThreadTester(int i) {
            x=i;
        public void run(){
    StaticTest newInstance = new StaticTest(); //Create a new instance
            newInstance .test(x);
    }Alain

  • Regarding 'get_attribute_props_for_node'* method from if_wd_context_node

    hello gurus,
                    i have requirement in a view it has two radio buttons named as release and un release.if i select release button the view data in display mode only , it meaans in view one header information and one item table is there.in the second case when i select un release button the view data again in change mode.how can i achive this requirement.right now i can get the release status at runtime through radio button group by key ui element onselect action.now i need to impliment depends upon release information view data into change mode or display mode. for this can we use 'get_attribute_props_for_node' method from if_wd_context_node . if yes how can we pass parameters to this method and how can i achive my requirement through this.
    i am very new for webdynpro abap .could any one suggests me on this and could any one can send sample code regarding this if possible.
    thanks in advance for your reply
    regards,
    babu

    Hi Rajasekhar,
    For ALV you have to write some code like this.. follow this
    lr_column = lr_column_settings->get_column( 'FIELD' ). // Field is one field you wnat to display in edit mode..
          CREATE OBJECT lr_input_field
            EXPORTING
              value_fieldname = 'FIELD'.
          lr_input_field->set_read_only( abap_true ).
          lr_column->set_cell_editor( lr_input_field ).
    OR folow below
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1?quicklink=index&overridelayout=true
    http://forums.sdn.sap.com/click.jspa?searchID=72897441&messageID=6805421
    foolow LEkhas answer in this
    Edit few fields in an ALV table
    also this..
    ALV: columns in read-only mode look like editable columns in edit mode
    O/P ALV in edit mode
    Cheers,
    Kris.

  • GetColumnClass() method of JTables

    Is it possible to display 2 different types in the same column of a JTable?
    For example: In some rows should be CheckBoxes and in some should be nothing displayed.But the problem is that I've to implement the getColumnClass() method.
    Or is there another way with a different method to tell each cell which type of component it contains so that it can tell this to its renderer and display it in the right way

    It depends on what you're really trying to do. The theory behind tablular data is that a column contains values of a particular data type. the getColumnClass(int col) method returns the Class of the data objects. A JCheckBox is commonly used to render Boolean objects but the getColumnClass call would return Boolean.class.
    So, In your design, what would determine when a JCheckBox should be in a particular cell and when "nothing" should be displayed? Are you planning a check box for true and nothing for false, or maybe a check box for true or false and nothing if that value is null.
    You could probably accomplish would you want by implementing a custom TableCellRenderer.
    Cheers
    DB

  • Regarding Node methods........?

    Hi all,
    In my scenario ,i have a column of chekboxes in my ALV.aftr that user can select any no checkboxes.
    whwn user check on checkbox,the record must selected and finally i have to pass all those selected records into on table.
    how can do it?
    method ON_DATA_CHECK .
    data:
        Node_Ep_Sch_Info                    type ref to If_Wd_Context_Node,
        Elem_Ep_Sch_Info                    type ref to If_Wd_Context_Element,
        lt_Ep_Sch_Info                    type If_Ep_Sch_Details=>Elements_Ep_Sch_Info ,
        ls_Ep_Sch_Info                    type If_Ep_Sch_Details=>Element_Ep_Sch_Info ,
         lv_checked                       type If_Ep_Sch_Details=>Element_Ep_Sch_Info-CHK_BOX.
         Node_Ep_Sch_Info = wd_Context->get_Child_Node( Name = IF_EP_SCH_DETAILS=>wdctx_Ep_Sch_Info ).
      Node_ep_sch_info->get_static_attributes_table( importing TABLE = lt_ep_sch_info ).
    LOOP AT LT_EP_SCH_INFO INTO LS_EP_SCH_INFO.
    IF LV_CHECKED EQ 'X'.
    Node_ep_sch_info->SET_SELECTED( ).
    ENDIF.
    ENDLOOP.
        Node_ep_sch_info->GET_SELECTED_ELEMENTS( ).
    endmethod.
    i used above scenario.here what is the return type of GET_SELECTED_ELEMENTS( ).how can i pass these selected elements into one table?
    Regards,
    Ravi.

    Hi ravi
    Create a internal table it_newdata having same structure as your context node, to do so:
    Data: it_newdata   type  IF_viewname=>elements_nodename.
    Say if I have a view called DISPALY having a context node 'DATA'  then to declare a internal table having the same line type as of attributes of data write:
    Data: it_newdata  type if_display=>elements_data,
           ls_newdata   like line of  it_newdata.      " work area
    Now as I mention in my previous reply in the loop statement, fill the internal table it_newdata .
    loop at it_selected_row into ls_selected_row.
    *get all the attributes of every element
    CALL METHOD ls_selected_row->get_static_attributes
    IMPORTING
    static_attributes = stru_Ep_Sch_Info.
    ls_newdata-attrib1 = stru_Ep_Sch_Info-attrib1.
    ls_newdata-attrib2 = stru_Ep_Sch_Info-attrib2.
    ls_newdata-attrib3 = stru_Ep_Sch_Info-attrib3.
    append ls_newdata to it_newdata .
    clear: ls_newdata.
    endloop.
    Read your node say : DATA using code wizard which you want to fill. It will give you stryu_data, elem_data and node_data. use node_data
    Now bind the data to the context node
      Node->Bind_Table(
        New_Items =  it_newdata
        Set_Initial_Elements = Abap_True ).

  • Regarding percentage methods

    hi all
    my client is indian based i need clarificafication regarding calculation of
    percentages on different assets like buildings, plants,machinaries,and furniture,computers.
       my question is :is there any pre defined percentages for these assets to calculate depreciation,on what basis we calculate that means tax,p&l,balnsheet
    pls clarify my query
    regards
    chandra.

    Hello
    Multi-Level Method
    Use
    Base methods for certain depreciation calculation methods (Stated percentage and Total percentage in concessionary period) use either a total percentage rate or a periodic percentage rate to calculate depreciation. You can divide these calculation keys into as many levels as you like. A level, in this sense, represents the period of validity of a certain percentage rate. This percentage rate is then replaced by the next percentage rate when its period of validity has expired.
    Features
    Period of Validity for the Individual Levels
    You determine the validity period for the individual levels of a key by specifying the length of time in years and months. You can choose whether the defined validity period begins with
    The capitalization date
    The start date for ordinary or tax depreciation
    The original acquisition date of the asset under construction
    The changeover year
    The defined time periods of a key always have a common start date. This means that the period from the start of one key to its end will overlap with the next period, which has the same start date but a longer validity period. Therefore, you have to enter the validity periods for the levels in cumulative form.
    There is a special indicator you can use when you work with non-calendar fiscal years. The indicator allows you to specify that the definition of the levels applies to the fiscal year and not to the calendar year. However, be aware of the considerations involved when using shortened fiscal years (see Shortened Fiscal Years ).
    Depreciation Percentage Rates
    How you enter the depreciation percentage rate is dependent on the depreciation calculation method being used:
    When using the Total percentage in concessionary period depreciation calculation method, you also have to enter the depreciation percentage rate in cumulative form (see example).
    When using the Stated percentage depreciation calculation method, you do not enter the percentage rate in cumulative form.
    The following example shows the definition of five levels, each one of which should last for a year. The Total percentage in concessionary period depreciation calculation method is being used. The depreciation percentage rates in the individual years are 60, 10, 10, 10, and 10%.
    Validity period
    Percentage
    1 year
    60
    2 years
    70
    3 years
    80
    4 years
    90
    5 years
    100
    In addition, you can limit the levels according to specific acquisition years. This enables you, for example, to observe certain legal requirements that place time restrictions.
    Suresh

  • HElp needed regarding oci methods..

    hi,
    Dont we have oci functions which perform same task like these methods in mysql : mysql_insert_id(),mysql_info(),mysql_select_db(), mysql_real_escape_string().Actually we are working on some conversion form mysql to oracle..so we need these methods...If anyone already worked in such conversion will definitely be of great help.
    Thanks.
    srinath.

    Hi,
    since MySQL is a completly different system, the functions to connect and access are also completely different.
    Oracle doesn't use fields, which are incrementet by "auto_increment". In a Oracle DB, you will instead use a Sequence and a Trigger for this:
    Let's say you have a table "katalog" with a primary key "KAID" it will look like this:
    -- Creating the Sequence:
    CREATE SEQUENCE SEQ_KATALOG_KAID INCREMENT BY 1 START WITH 1 MAXVALUE 999999999999 MINVALUE 1 ;
    -- Creating the Trigger, to use the Sequence:
    CREATE OR REPLACE TRIGGER "KT"."TR_KATALOG_KAID" before insert on "KATALOG"
    for each row begin
    if inserting then
    if :NEW."KAID" is null then
    select SEQ_KATALOG_KAID.nextval into :NEW."KAID" from dual;
    end if;
    end if;
    end;
    ALTER TRIGGER "KT"."TR_KATALOG_KAID" ENABLE;
    If you need to replace mysql_insert_id, you can use:
    SELECT SEQ_KATALOG_KAID.currval AS KAID from dual;
    Instead of using mysql_select_db(), you can select the database to use during connecting with OCI_connect(), or OCI_logon();
    To have another database connected, during the script-runtime, you can either use oci_new_connect(), or use "CONNECT username/password@host/service" as an SQL statement.
    Instead of using mysql_real_escape_string(), I think you have to test every single input, before using it as a value within your SQL statements.
    Greetings from Hamburg
    Thorsten

  • Question regarding a method of stocking data

    I know this thread already is in the "New to Java Technology" Forum, although I said the topic was closed there so I could open it back here.. I realized it would be more fitting here and it would probably get more replies...
    I am working with a friend on a Client for Ultima Online and we have to stock data concerning the various objects and characters in the same sector as the Client. We have 3 ideas of what the best method could be, but we have no clue which method would be the most performant (concerning both speed and memory), or if there is a better method to do so.
    Here's a description of the methods we thought about:
    Method #1
    Create many class files for each type of object, having the various related variables in their respective classes...
    Exemple: A principal class called DataObject which holds the data common to all objects/characters. Classes which extends DataObject such as DataMobile (for the Characters) and DataItem (for the Items) in which the data specific to characters and items is stocked. And also various classes for the various types of objects such as Containers which will extend DataItem...
    Method #2
    Create a single class file which would hold an Array containing the various variables and of which the size would be the maximum amount of parameters possible. The array would work in relation with a byte which would hold the type of data stocked into the Array, this way we could know the structure of data and retrieve this data where it is in the Array...
    M�thod #3 <= This one was the first idea and we know it is the worse one.. Telling you about it though
    Create a single class file which would hold all the possible variables. These variables would only be used when necessary.
    M�thod #4
    Create a single class file which would extend java.util.Hashtable. The parameters would be stocked this way: The Key mapped to the value would be the type of parameter (represented by a Byte (not byte)) (type of parameter such as Serial, Name, Strenght, Dexterity, etc...). And the value would be stocked as a String, Integer, Short or Byte according to the case (once again, it isn't primitives, it is the classes from java.lang.*).
    Thanks in advance for the suggestions :)

    This is not an advanced language topic. This is a beginner question, I would be very surprised if you got an answer in this forum.

  • Query regarding onNavigate method in a tableview control

    hi all,
    i am using a tableview control in jspdynpage to display the sales order details using the standard BAPI that is BAPI_SALESORDER_GETLIST.
    following is the flow:-
    i enter the customer number and the sales organization in the first i-view.
    it interacts with the backend and brings the data into a tableview control in the second i-view.
    the problem i am facing is:-
    when i click on the navigation button of the tableview control instead of showing the next row of records, it takes me back to the previous i-view.
    please help as i am unable to find the error myself.
    i can post the code if you want.....
    regards,
    raghav

    i am posting the code...
    main class
    package com.sap.training;
    import javax.resource.cci.MappedRecord;
    import javax.resource.cci.RecordFactory;
    import com.sap.portal.services.api.connectorgateway.IConnectorGatewayService;
    import com.sapportals.connector.connection.IConnection;
    import com.sapportals.connector.execution.functions.IInteraction;
    import com.sapportals.connector.execution.functions.IInteractionSpec;
    import com.sapportals.connector.execution.structures.IRecordSet;
    import com.sapportals.htmlb.InputField;
    import com.sapportals.htmlb.event.Event;
    import com.sapportals.htmlb.event.TableNavigationEvent;
    import com.sapportals.htmlb.page.DynPage;
    import com.sapportals.htmlb.page.PageException;
    import com.sapportals.portal.htmlb.page.JSPDynPage;
    import com.sapportals.portal.htmlb.page.PageProcessorComponent;
    import com.sapportals.portal.ivs.cg.ConnectionProperties;
    import com.sapportals.portal.ivs.cg.IConnectorService;
    import com.sapportals.portal.prt.component.IPortalComponentContext;
    import com.sapportals.portal.prt.component.IPortalComponentRequest;
    import com.sapportals.portal.prt.component.IPortalComponentResponse;
    import com.sapportals.portal.prt.runtime.PortalRuntime;
    public class getsalesorder extends PageProcessorComponent {
         //private getdatabean first_bean;
         public DynPage getPage() {
              return new getsalesorderDynPage();
         public static class getsalesorderDynPage extends JSPDynPage {
              public getdatabean data;
              private getdatabean data1;
              public IRecordSet exportTable = null;
              private final static int INITIAL_STATE = 1;
              private final static int NEXT_STATE = 2;
              private int state = INITIAL_STATE;
              //private getdatabean myBean = null;
              IPortalComponentRequest request = null;
              IPortalComponentResponse response = null;
              IPortalComponentContext ctxt = null;
              private int visibleRow;
              public void doInitialization() {
              public void doProcessAfterInput() throws PageException {
              public void doProcessBeforeOutput() throws PageException {
                   switch (state) {
                        case INITIAL_STATE :
                             this.setJspName("getdata.jsp");
                             break;
                        case NEXT_STATE :
                             this.setJspName("showresult.jsp");
                             break;
              public void onShowClick(Event event) {
                   IPortalComponentResponse response =
                        (IPortalComponentResponse) this.getResponse();
                   InputField CUSTOMER_NUMBER =
                        (InputField) getComponentByName("myInputField1");
                   String customerNumber =
                        CUSTOMER_NUMBER.getValueAsDataType().toString();
                   InputField SALES_ORGANISATION =
                        (InputField) getComponentByName("myInputField2");
                   String salesOrganisation =
                        SALES_ORGANISATION.getValueAsDataType().toString();
                   request = (IPortalComponentRequest) getRequest();
                   response = (IPortalComponentResponse) getResponse();
                   IConnectorGatewayService cgService =
                        (IConnectorGatewayService) PortalRuntime
                             .getRuntimeResources()
                             .getService(
                             IConnectorService.KEY);
                   ConnectionProperties prop =
                        new ConnectionProperties(
                             request.getLocale(),
                             request.getUser());
                   IConnection client = null;
                   try {
                        client = cgService.getConnection("R3System", prop);
                   } catch (Exception e) {
                        response.write(e.toString());
                   try {
                        IInteraction ix = client.createInteractionEx();
                        IInteractionSpec interactionSpec = ix.getInteractionSpec();
                        interactionSpec.setPropertyValue(
                             "Name",
                             "BAPI_SALESORDER_GETLIST");
                        RecordFactory rf = ix.getRecordFactory();
                        MappedRecord input = rf.createMappedRecord("input");
                        input.put("CUSTOMER_NUMBER", customerNumber);
                        input.put("SALES_ORGANIZATION", salesOrganisation);
                        MappedRecord output =
                             (MappedRecord) ix.execute(interactionSpec, input);
                        Object rs = null;
                        Object result = output.get("SALES_ORDERS");
                        if (result == null) {
                             rs = new String(" ");
                        } else if (result instanceof IRecordSet) {
                             exportTable = (IRecordSet) result;
                             exportTable.beforeFirst();
                        //                    while (exportTable.next())
                        //                                   response.write("<script language='JavaScript'>");
                        //                                   response.write( "alert('" + exportTable.getString("MATERIAL")+"');" );
                        //                                   response.write("</script>");     
                        //                    exportTable.beforeFirst();
                   } catch (Exception e) {
                        response.write(e.toString());
                   } finally {
                        if (client != null) {
                             try {
                                  client.close();
                                  client = null;
                             } catch (Exception e) {
                   ctxt =
                        ((IPortalComponentRequest) getRequest()).getComponentContext();
                   Object O = ctxt.getValue("data");
                   if (O == null || !(O instanceof getdatabean)) {
                        data = new getdatabean(request, response);
                        data.createData(exportTable);
                   } else {
                        data = (getdatabean) O;
                        data.createData(exportTable);
                   ctxt.putValue("data", data);
                   state = NEXT_STATE;
              public void onBackClick(Event event) {
                   response = (IPortalComponentResponse) getResponse();
                   state = INITIAL_STATE;
              public void onNavigate(Event event) throws PageException {
                   if (event instanceof TableNavigationEvent) {
                        TableNavigationEvent tne = (TableNavigationEvent) event;
                        if (tne != null) {
                             this.visibleRow = tne.getFirstVisibleRowAfter();
                             if (data != null) {
                                  data.setVisibleRow(
                                       new Integer(this.visibleRow).toString());
    bean class
    package com.sap.training;
    import java.io.Serializable;
    import java.util.Vector;
    import com.sapportals.connector.execution.structures.IRecordSet;
    import com.sapportals.htmlb.table.DefaultTableViewModel;
    import com.sapportals.portal.prt.component.IPortalComponentRequest;
    import com.sapportals.portal.prt.component.IPortalComponentResponse;
    public class getdatabean implements Serializable {
         private String visibleRow="1";
         public IRecordSet exportTable = null;
         public DefaultTableViewModel model;
         public IPortalComponentRequest request;
         public IPortalComponentResponse response;
         public getdatabean(){
              model = new DefaultTableViewModel();
         public getdatabean(IPortalComponentRequest request,IPortalComponentResponse response)
              this.request = request;
              this.response = response;
         public DefaultTableViewModel getModel() {
              return this.model;
         public void setModel(DefaultTableViewModel model) {
              this.model = model;
         public void createData(IRecordSet exportTable) {
              this.exportTable = exportTable;
         public DefaultTableViewModel getModel1() {
              Vector data = createData1();
              Vector colName = new Vector();
              colName.addElement("Material");
              colName.addElement("Document Date");
              model = new DefaultTableViewModel(data, colName);
              return model;
         private Vector createData1() {
              Vector retVec = new Vector();
              try {
                   while (exportTable.next()) {
                        //response.write("data is in export");
                        Vector dataVec = new Vector();
                        dataVec.addElement(exportTable.getString("MATERIAL"));
                        dataVec.addElement(exportTable.getString("DOC_DATE"));
                        retVec.addElement(dataVec);
              } catch (Exception e) {
                   response.write("EXCEPTION...........");
                   response.write(e.toString());
              return retVec;
         public void setVisibleRow(String string) {
              visibleRow = string;          
         public String getVisibleRow(){
              return visibleRow;
    1st jsp
    <%@ taglib uri="tagLib" prefix="hbj" %>
    <jsp:useBean
         id="data1"
         scope="application"
         class="com.sap.training.getdatabean"
         />
    <hbj:content
         id="myContext">
         <hbj:page
              title="PageTitle">
              <hbj:form
                   id="myFormId">
                   <hbj:textView
                        id="CUSTOMER_NUMBER"
                        text="CUSTOMER_NUMBER"
                        design="EMPHASIZED"/>
                   <hbj:inputField
                        id="myInputField1"
                        type="String"
                        value=""
                        maxlength="30">
                   </hbj:inputField>
                   <br>
                   <br>
                   <hbj:textView
                        id="SALES_ORGANIZATION"
                        text="SALES_ORGANIZATION"
                        design="EMPHASIZED"/>
                   <hbj:inputField
                        id="myInputField2"
                        type="String"
                        value=""
                        maxlength="30">
                   </hbj:inputField>
                   <br>
                   <br>
                   <hbj:button
                        id="show"
                        text="show"
                        width="100px"
                        tooltip="click here to show result"
                        onClick="onShowClick"
                        disabled="false"
                        design="STANDARD">
                   </hbj:button>
              </hbj:form>
         </hbj:page>
    </hbj:content>
    2nd jsp
    <%@ taglib uri="tagLib" prefix="hbj" %>
    <jsp:useBean
         id="data"
         scope="application"
         class="com.sap.training.getdatabean"
         />
    <hbj:content
         id="myContext">
         <hbj:page
              title="PageTitle">
              <hbj:form
                   id="myFormId">
                   <hbj:tableView
                        id="tv"
                        design="ALTERNATING"
                        headerVisible="true"
                        footerVisible="true"
                        fillUpEmptyRows="false"
                        navigationMode="BYLINE"
                        headerText="sales order details"
                        onNavigate="onNavigate"
                        visibleFirstRow="<%= data.getVisibleRow() %>"
                        visibleRowCount="5"
                        rowCount="20"
                        width="300 px">
                        <%
                        tv.setModel(data.getModel1());
                        %>
                   </hbj:tableView>
                   <hbj:button
                        id="back"
                        text="back"
                        width="100px"
                        tooltip="click here to go back"
                        onClick="onBackClick"
                        disabled="false"
                        design="STANDARD">
                   </hbj:button>
              </hbj:form>
         </hbj:page>
    </hbj:content>
    deployment descriptor
    <?xml version="1.0" encoding="utf-8"?>
    <application>
      <application-config>
        <property name="PrivateSharingReference" value="com.sap.portal.htmlb"/>
        <property name="ServicesReference" value="com.sap.portal.ivs.connectorservice"/>
      </application-config>
      <components>
        <component name="getsalesorder">
          <component-config>
            <property name="ClassName" value="com.sap.training.getsalesorder"/>
          </component-config>
          <component-profile>
            <property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>
          </component-profile>
        </component>
      </components>
      <services/>
    </application>

Maybe you are looking for

  • What is the DebugTmp.txt that showed up on my computer?

    In my documents folder I found a file called DebugTmp.txt, what is this? Is it a virus? What should I do about it?

  • Text not being allowed

    I am allowed to post a text into my movie, but when I do it covers the entire movie. I then crop it down to where it belongs, but it then will not accept anymore text. It's as if the open area still sees the original text as being there after it has

  • How can I request an enhancement to Thunderbird?

    I'd like to see a capability in Thunderbird that would allow user to switch on/off (ie an over-ride of current system setting) "saving a copy" at an individual e-mail level at time of creation/send of the e-mail. For example, my personal default sett

  • LP type delivery not shown on MD04

    Why LP type delivery document is not visible on MD04 screen? and can we make it visible?

  • Unibody Mac Mini Crashes

    My Unibody Mac Mini Crashes when I switch my 1080P Samsung's input sources and when I switch back to the HDMI input source that the Unibody mac mini is on the Mini crashes and I have to hold down the power button to restart it. I don't know why this