How can I obtain the primary key of a table for an entity relation?

hello everybody
I am doing a consultation to a table in my data base, good this table has alone two fields, the first one is the code or pk and the second one is the description, to be presisos they are names of city and code.
From the beginning!!: This method this one in another class that is a Dialog that is going to call to the class SelecPlace ();
  SelecPlace sl = new SelecPlace();
public void capturarLugar(){  //  Simple void method in the mentioned class
        String place = txtProcedencia.getText() ;  //  a JTextField
        sl.executeStatement(place) ;                  
    }ok, now we see part of the code of the class SelectPlace
public class SelecPlace extends AbstractTableModel{
    Connection con = null;
    Statement sentencia = null ;
    ResultSet rs = null;
    ResultSetMetaData rsmd = null ;
    String[] nameColum = {} ;
    Vector datos = new Vector() ;
    public SelecPlace() { }
    public void executeStatement(String query){
      try{
         con = DBManager.getConnection() ;
         sentencia = con.createStatement(rs.TYPE_SCROLL_INSENSITIVE,
                                                                      rs.CONCUR_UPDATABLE) ;
         String sql = "select * from Place where descripcion like %"+query+"%'";
          rs = sentencia.executeQuery(sql) ;
          rsmd = rs.getMetaData();
          int nroColumnas = rsmd.getColumnCount() ;
          nameColum = new String[nroColumnas] ;
          //obtengo los nombres de columnas en cache
           for(int colum = 0; colum < nroColumnas; columna++){
                nameColum[colum] = rsmd.getColumnLabel(columna + 1) ;
           datos = new Vector();
            while(rs.next()){
                Vector newRow = new Vector();
                for(int i = 0; i < getColumnCount(); i++){
                newRow.addElement(rs.getObject("place_ID"));
                newRow.addElement(rs.getObject("description"));
                datos.addElement(nuevaFila);
            fireTableChanged(null);
        }catch(SQLException e){
            System.err.println(e);
            e.printStackTrace(System.err);
            System.out.println("error in statement");
        }catch(ClassNotFoundException cnfe){
            System.err.println(cnfe);
    }Ok, this code me works and I obtain in this case the field description of the table Place
Now my question is, how can I obtain the primary field of my table?
I need this value of this field that in the base of information in a bigint, and to take it to the first class before mentioned, for that I am working with a data base related

Certain duffymo and everyone!!, good I give you my scheme:
And generalizing my question, I want to obtain the value of the primary key of a table in the database, I obtain more values of the same row, but I need the primary key, and you see one with the primary key I want to turn a Long and it to insert with code java in foreign clave in another table of the database
Good of this form I believe that it would not be breaking the integrity relacional of the tables

Similar Messages

  • How can we automate the Depreciation keys based on production for business

    How can we automate the Depreciation keys based on production for business u2013 this is currently not an optimised process if we expect business to manually change the keyu2019s on a monthly basis.
    The end user updates the table, transaction AO25, manually on month end after the production calculations are completed. The question is, is it possible when the PP is completed, that the system updates the Period Unit table for that period?
    Thanks.
    Regards,
    PS PS

    Hi,
    I am new at this, so I need a explanation on how will this help me, and how do I get about doing this?
    Thanks a lot.
    Regards,
    PS PS

  • How can we export the Primary key values (along with other data) from an Advantage database?

    One of our customers is moving from our application (which uses Advantage Database Server) to another application (which uses other database technology). They have asked us to help export their data, so that they can migrate it to another database system. So far, we have used the Advantage Data Architect (ARC32) "Export Table Structures as Code" functionality to generate SQL. We used the "Include existing data" option. The SQL contains the necessary code to recreate the tables and indexes. The customer's IT staff will alter the SQL statements as necessary for their new system.
    However, there is an issue with the Primary Keys in these table. The resulting INSERT statements use AutoInc as the type for the Primary Key in each Table. These INSERT statements contains "DEFAULT" for the value of each of these AutoInc fields. The customer would like to output an integer value for each of these Primary Key values in order to maintain referential integrity in their new system.
    So far, I have not found any feature of ARC32 that allows us to export the Primary Key values. We had been using an older version of ARC32, since our application does not use the latest version of ADS. I did download the latest version of ARC32 (11.10), but it does not appear to include any new functionality that would facilitate doing this sort of export.
    Can somebody tell me if there is such a feature in ARC32?
    Or, is there is another Advantage tool to facilitate what we are trying to accomplish?
    If there are no Advantage tools to provide such functionality, what else would you suggest?

    George,
      It sounds like the approach you are using is the correct one. This seems to be the cleanest solution to me especially since the customer is able to modify the generated SQL statements for their new system.
      In order to preserve the AutoInc values I would recommend altering the table and changing the field datatype from AutoInc to Integer. Then export the table as code which will export the actual values. After the tables have been created on the new system they can change the field datatype back to an AutoInc type if necessary.
    Regards,
    Chris Franz

  • How to find out the primary key of oracle apps tables

    Hii,,
    My Question is How to find the primary key in the apps table...Is there any Query or other way to find out???
    for eg.
    I want to find out the primary key of the AP_INVOICES_ALL table...just tell me how can i get the primary key of this table.
    I am currently using toad for the query..
    Please guide me...

    you can define the primary key when you create table
    or add the primary key after the table creation by 'ALTER TABLE ... ADD constraint pk_nme primary key (col1, col2)';
    you could use below sql to check the detail of primary key:
    1) check out the table definition directly:
    select dbms_metadata.get_ddl('TABLE','EMP') FROM DUAL;
    2) check out the columns of primary key:
    select * from user_constraints where constraint_type='P' AND table_NAME='EMP';
    select * from user_cons_columns where CONSTRAINT_NAME='PK_EMP';And BTW, it is madam, not sir. :)
    Edited by: PhoenixBai on Dec 17, 2010 1:07 PM

  • My laptop has FileVault turned on. How would I obtain the Recovery Key from Apple should I need it?

    My laptop has FileVault turned on. I remember a Recovery Key was created for me but I can't find it. I do know the log in password for my computer so I am not locked out. How would I obtain the Recovery Key should I need it?

    http://support.apple.com/kb/PH11381 

  • Trying to install Acrobate 8 Standard on PC with Windows 7, 64 bit. During the installation I was asked to provide "File Adobe PDF.dll for Windows Vista. How can I obtain the required file?

    Trying to install Acrobate 8 Standard on PC with Windows 7, 64 bit. During the installation I was asked to provide "File Adobe PDF.dll for Windows Vista. How can I obtain the required file?

    Nothing in the Acrobat 8.x product family is compatible with Windows 7 (or any contemporary OS).
    The Acrobat 8.x product family passed into End of Support way back -- (November 2011).
    The current release of Acrobat (XI) is compatible in Windows 7.
    Be well...

  • How can I obtain the value of a database column in a JSP variable ?

    How can I obtain the value of a table column in a JSP variable?
    For example the <jbo:ShowValue datasource="cl" dataitem="Cont" ></jbo:ShowValue>
    I need to have it in a variable like this:
    <% String cnt=<jbo:ShowValue datasource="cl" dataitem="Cont" ></jbo:ShowValue>; %>
    But it is not workig this way.
    Please help me to obtain the value.
    I am using JDev RC2.
    Thanks.

    Try something like
    String cnt = c1.getRowSet().getCurrentRow().getAttribute("Cont").toString();
    -A
    How can I obtain the value of a table column in a JSP variable?
    For example the <jbo:ShowValue datasource="cl" dataitem="Cont" ></jbo:ShowValue>
    I need to have it in a variable like this:
    <% String cnt=<jbo:ShowValue datasource="cl" dataitem="Cont" ></jbo:ShowValue>; %>
    But it is not workig this way.
    Please help me to obtain the value.
    I am using JDev RC2.
    Thanks.

  • Hi,  I lost my serial number for PS Elements11 following computer crash. Os is W7. I have the cd installation disc but there is no serial number with it or in the envelope  ..  How can I obtain the serial number please?     Thanks

    I lost my seriel number for PS Elements 11 following computer crash. Os is W7
    Peter Jones Aug 27, 2014 5:36 AM   
    Hi,
    I lost my serial number for PS Elements 11 following computer crash. Os is W7. I have the cd installation disc but there is no serial number with it or in the envelope
    How can I obtain the serial number please?
    Thanks

    If you registered the software you should be able to find the serial number thru your Adobe account online.
    To locate the serial number:
    http://helpx.adobe.com/x-productkb/global/find-serial-number.html

  • How Can I obtain the tables of one schema and the record size???

    How Can I obtain the tables of one schema and the record size???
    Example:
    TableName Record Size
    Tabla1 12500
    Tabla2 7800
    Tabla3 2046

    This is not an OWB question, but you can obtain bda-type information on tables by using the system view dba_tables.
    Regards:
    Igor

  • How can I obtain the resources in jar?

    How can I obtain the resources in jar if the class that to want this resource is static?
    I don't succeed use like:
    getClass().getResourceAsStream("/" + name)
    because my class is static.
    Thaks

    You could do this
    new Object().getClass().getResourceAsStream("/" + name)
    or
    Object.class.getResourceAsStream("/" + name)

  • How can I obtain the web site template of the ''Imvelo Safari Lodges'' that appears on the Site of the day web page?

    How can I obtain the web site template of the ''Imvelo Safari Lodges'' that appears on the Site of the day web page?

    Hi Ginette,
    The site that you are referring to does not appear to be a template that you can get your hands on, however, I will suggest that you contact the owner via their contact us page and see what can be done.
    - Abhishek Maurya

  • How can i disable the Enter key in JTextArea?

    How can i disable the Enter key in JTextArea?
    When i press Enter key in JTextArea,I hope JTextArea do nothing.
    Thanks!

    HI, I've the same problem;
    uncle_alice solution works fine, but if I paste in textArea a multi-line text,
    this last results on more lines (rows);
    Isn't possible to avoid this?
    Alternatively, how can I disable cut/copy/paste on TextArea?
    Thank you in advance.
    MargNat
    Message was edited by:
    MargNat

  • I'm using LR 5.6.  The Enter key should increase the exposure but it increases Contrast instead.  How can I make the Enter key adjust the exposure?

    Hello
    As explained in the heading, I'm using LR 5.6 on a PC (Win 7).  The Enter key should increase the exposure but it increases Contrast instead.  How can I make the Enter key adjust the exposure, as it should?  I have reset the settings to Default in the Develop module but to no avail.  Please help!  Thanks.
    Kind Regards
    Farrukh Hyder

    I am not aware that the ENTER key should increase exposure, and it certainly does not increase exposure (or any other slider) on my Lightroom 5.6 (Windows 7)
    If you click on the word Exposure, then the + and - keys increases or decrease exposure by 0.1 or -0.1

  • How can I disable the control key?

    How can I disable the control key?
    My Controll-Key is permanently pressed.... i dont know why, please help me!

    Take it to an Apple store or dealer to get it repaired.

  • How can I obtain the Pages app which I previously purchased from the App store for Snow Leopard? The only download now available is for Mountain Lion which my computer can't run. Thanks

    How can I obtain the Pages app which I previously purchased from the App store for Snow Leopard? The only download now available is for Mountain Lion which my computer can't run. Thanks

    Try Amazon but look for the iWork suite of software. It's only sold separately as Pages, Keynote, and Numbers from the App Store.

Maybe you are looking for

  • How to reduce jpeg size of logo to fit custom form in acrobat pro XI?

    I am creating a form from scratch in acrobat pro XI, and our logo is too big - an error message comes up as soon as I insert the logo picture, that says too big, must reduce.  currently its taking up the entire form. thanks!

  • Q about( for) and (if) statements

    Hi I am not sure whether i am right or not, but i found that (for) or (if) statement cannot be written outside constructors and when i try to write it (illegal epxpression start ) message appears. my Q is it must be written inside constructor ? Actua

  • Problem in follow up for email in exchange2010

    Hi,   We have also to support exchange 2010 for flagging. Was able to support flagging for exchange2013 with answer from this link http://social.msdn.microsoft.com/Forums/office/en-US/0b3faf0d-4457-405d-bc71-0594575885c8/action?threadDisplayName=faci

  • I can't open Gmail in Firefox. Used to work but now nothing.

    It seems I am getting the same as others. Google works fine. Gmail works in Google but not in Firefox. Was OK but now get the error message; "Firefox has detected that the server is redirecting the request for this address in a way that will never co

  • 5dmk3 issues

    I've hired the 5dmk3 and was looking at purchasing one maybe next week. I have taken some test shots (RAW) and taken them into Adobe Camera Raw to look at. Strangely the default settings aren't set to Zero? Im using Camera Raw 8.3 for CS6. I shot in