Primary key in adf create form

Hi,
I want to insert data to a table which has primary key. I have created a sequnece wich produces the uniq key number and trigger for before insert wich puts the number.
Even I have trigger , when I commit a create form (I have drop create form on jsf page from datacontrol palette and put a commit button ) I get an error which says that this field is required. Is there something I missed??Anyone who has an idea??
Please I need any kind o fhelp...
Thank you very very much in advance
Regards

Thanks a lot, it worked. But it doesnt work if I have mandatory columns.Even I put some values when I commit I get the message that the value of this columns are required. Then I did something else. I changed back the primary key column from DBsequence to NUMBER and from the page's bean I put default vallue for it. In this case it works. Which way I should prefer? Is there something else that I have to add when I set the type to DBSequence?
Thanks in advance
Regards

Similar Messages

  • Missing primary key column in created form?

    Please help. I am a newbie in apex.
    When i create form and view it later I am missing primary key column.
    HOw to make it show?
    Thanks in advance.

    Hi,
    While creating the form based on a table/view, what have you chosen to populate the primary key value? Existing Triggers or Existing Sequences or Custom PL/SQL function?
    Can you check for the Get PK pl/sql process in the page processing region of the related form page? If that function is missing then do the following steps to create the same,
    Step 1 : Create a new pl/sql process.
    Step 2 : Choose the Process Point as, On Submit After Computations and Validations.
    Step 3 : Write the following block,
    declare
      function get_pk return varchar2
      is
      begin
        for c1 in (select TEST_SEQ.nextval next_val
                   from dual) -- Create a new sequence for your requirement.
        loop
            return c1.next_val;
        end loop;
      end;
    begin
      :P3_TEST := get_pk;  -- Change the item name for your page.
    end;After doing all the above, try executing the page.
    Regards,
    Sakthi.

  • How to generate the primary key item automatically in form region?.

    Hi,
    The primary key item is generated automatically in report region.I already give the pl/sql function for generating of primary key.but I want to generate the primary key value automatically in form region only?.how to do this?.Pls help me..
    Thanks and Regards.

    One of the guidelines when selecting column for a primary key is:
    Choose a column whose data values are never changed. A primary key value is only used to identify a row in the table, and its data should never be used for any other purpose. Therefore, primary key values should rarely or never be changed.
    Cheers!

  • ADF create form problem

    Hello forum, I know - I am back again. But I am having all kinds of issues developing this ADF BC create form. Given the following scenario, can somebody please explain how he/she would set out to create the following ADF create form?
    You a have a db entity call it table with fields1 through 10. During any create transaction, one of field1 or field2 or field3 must be present together with field4 through 10. That is, field1 can be entered along with fields 4 to 10 or field2 can be entered together with fields 4 to 10 or field3 and fields 4 - 10. Field10 can have four exclusive choices (say a, b, c, d) and should default to d (radio button). Field3 should store the name of an uploaded file. At no time can fields 1, 2 and 3 be entered. It is either one or the other.
    Here's how I set out to develop this and have been running into all sorts of problems from Row inconsistency issues to 500 Internal errors. I created an unbound select one Radio component with three choices to display either field1 or field2 or field3 depending upon the radio button selected. I used the switcher facet to hide fields 1 and 2, show field 3 if radio button 3 was selected. So whenever radio button 1 was selected, field1 would be displayed, then fields 2 and 3 will be hidden. Initially, I used regular input components to display fields 1 to 3 and then try to map them back to the database but couldn't figure out how to do this. I then followed John's suggestion to use transient entity attributes. I did this but still couldn't figure out how to access their values so I could set the relevant db columns accordingly.
    Because of the way this requirement is, I had to drag and drop field1, 2, and 3 in three different single drag and drop operations, then drag and drop the entire collection with the option to include the submit button, delete fields 1 through 3 in another operation. This created 2 different iterators in the pageDef file. I am not an expert yet on ADF but maybe this might be part of my problems. Trying to use two different iterators to insert into a single table during a single DML operation. But then again both iterators are bound to the same entity. I am not sure anymore.
    Is anybody kind enough to take a look at what I have so far? John? Frank? Steve? Anybody? I am trying to make that switch from oracle forms to ADF. This is actually my first ADF form and so far it has been very frustrating. I really need help on this guys!!
    Thanks

    Thanks for the suggestion Frank! Just so I understand you, the ADF Faces text component that I am adding would be in addition to the radio select one component? Then if you click on radio button 1, enter data in the text field, that action should bind it to field1 and similarly for the other fields when radio button 2 or 3 is clicked? In this case I am assuming that I do not have to display the actual db fields1 - 3 on the form?
    This would be fine for fields1 and 2 (though field2 would require one to enter a substantial amount of text - on average a 1000 characters as opposed to field1 that has a maximum length of 40 characters). Field3 however is different because it should be an inputFile component in order to download OS files and store in the database. Thus the ADF Faces text component might not be able to handle this without substantial additional java code.
    Thanks again for your suggestions. I really appreciate it!

  • Row Currency Error in ADF Create Form

    Hi. Can anybody help me with this simple problem. I have been reading through the threads, and I tried the solutions, but it doesn't work.
    I am having this error:
    JBO-35007: Row currency has changed since the user interface was rendered. The expected row key was oracle.jbo.Key[-14 ]
    I have one page, with a form. The form was created by dragging a view from the Data Control. The primary key is of type DBSequence. the client side validation is disabled, so errors created are done by the ADF Model validation, since the fields has the af:validator in them.
    I clicked the submit once, it shows the error, for the required values. Without doing anything, I clicked the submit for a second time. I get the said error about the currency, as well as errors for required fields. Funny thing is, after clicking the submit button twice, besides the error, the control fields disappear. Its like its a new record.
    Can someone help? Thanks in advance.

    This is what I found out when asking our team that prepares the patches...
    As you know the patches are generic and as a result can be applied to other platforms that JDeveloper is supported on. However the .bat that comes in the patch is for Windows only, but for other platforms you can most times copy the script from the file and replace the windows commands with their equivalent, for the required OS. Of course, ensuring to follow the patch readme instructions and to test the customized script to ensure the updates are applied correctly.
    Open the bat file in a text editor and you should be able to see what files are being replaced and/or installed, and in what locations.
    For example, in the bat look for windows commands such as 'copy', 'move', 'del' (most of the scripts are failry easy to understand what is going on). Take a backup and replace the windows commands e.g. on unix/linux to 'cp', 'mv', 'rm'
    The windows commands in the bat file can be changed to the required operating system's equivalent commands. Change manually of using the text editor's search & replace functionality.
    If the customer isn't confident or comfortable doing that Support can help out.

  • How do I let user enter a primary key value on a form

    I'm creating my first APEX application. I have a simple table called HOSTS with 2 columns HOSTNAME and IP_ADDRESS. HOSTNAME is the primary key for the table. HOSTNAME is a perfectly acceptable primary key and I don’t wish to create an additional column to be populated by a sequence.
    What are my options for creating a form on the table without using "Existing trigger", "Custom PL/SQL function" or "Existing Sequence" to populate the primary key column, i.e. HOSTNAME, so that the user can enter a value for the primary key?
    Any assistance greatly appreciated.
    Gavin

    The debate about natural keys versus surrogate keys
    will no doubt continue with advocates for both sides.
    However there is also a difference between
    'making your life easier' for APEX development and
    'making your life more difficult' by having to
    analyse, implement and deploy a surrogate key only
    approach to an existing database which employs both
    natural keys and surrogate keys.
    hould we be forced to change the database design
    because a development tool does not cater for natural
    primary keys?The application development product is TRYING to save you from shooting yourself in the foot. The idea is to separate the primary key from being accessed by the user or ANY carbon based unit.. The key is mainly used by the system to join and lookup data rows, not for people to change whenever they decide that the key is WRONG.
    Think about this, if you use Last Name as a key in your system (a bad idea to begin with since this is NOT a unique id when you have two Smiths). When a person needs to change this because Jimmy Smith is NOT the only Smith working for Acme Toys, you have to cascade that change through all the child tables related to the main person table.
    If instead you use a system generated key, no change will be required since the key has NO relation to the data other than it represents a pointer to that row of data.
    Works for me, since I do not want to write all the supporting code when APEX builds it for you...
    Thank you,
    Tony Miller
    UTMB/EHN

  • How to specify  tablespace for a primary key inde in create table statement

    How to specify the tablespace for a primary key index in a create table statement?
    Does the following statement is right?
    CREATE TABLE 'GPS'||TO_CHAR(SYSDATE+1,'YYYYMMDD')
                ("ID" NUMBER(10,0) NOT NULL ENABLE,
                "IP_ADDRESS" VARCHAR2(32 BYTE),
                "EQUIPMENT_ID" VARCHAR2(32 BYTE),
                "PACKET_DT" DATE,
                "PACKET" VARCHAR2(255 BYTE),
                "PACKET_FORMAT" VARCHAR2(32 BYTE),
                "SAVED_TIME" DATE DEFAULT CURRENT_TIMESTAMP,
                 CONSTRAINT "UDP_LOG_PK" PRIMARY KEY ("ID") TABLESPACE "INDEX_DATA"
                 TABLESPACE "SBM_DATA";   Thank you
    Edited by: qkc on 09-Nov-2009 13:42

    As orafad indicated, you'll have to use the USING INDEX clause from the documentation, i.e.
    SQL> ed
    Wrote file afiedt.buf
      1  CREATE TABLE GPS
      2              ("ID" NUMBER(10,0) NOT NULL ENABLE,
      3              "IP_ADDRESS" VARCHAR2(32 BYTE),
      4              "EQUIPMENT_ID" VARCHAR2(32 BYTE),
      5              "PACKET_DT" DATE,
      6              "PACKET" VARCHAR2(255 BYTE),
      7              "PACKET_FORMAT" VARCHAR2(32 BYTE),
      8              "SAVED_TIME" DATE DEFAULT CURRENT_TIMESTAMP,
      9               CONSTRAINT "UDP_LOG_PK" PRIMARY KEY ("ID") USING INDEX TABLESP
    ACE "USERS"
    10               )
    11*              TABLESPACE "USERS"
    SQL> /
    Table created.Justin

  • How can I hide primary key column in BC4J form

    I have populated a primary key with dbsequence and how can I hide it on the form. It is populated in the DB by a trigger.

    I have populated a primary key with dbsequence and how can I hide it on the form. It is populated in the DB by a trigger. To hide it, edit the attribute using attribute-editor that you bring up by double-clicking on the attribute in the "StructurePane" .
    Then go to control-hints panel and mark the attribute setting for Display = Hide.
    Then UI wizards will not add the attribute into generated panels.
    However once you have UI generated, this hint is no more used.

  • Using a custom PL/SQL to populate the primary key in a tabular form

    I want to use a Custom PL/SQL Function to populate the primary key when I insert a new record into a tabular form. I want to get the value from a hidden page Item. The code I am using for the primary key source is:
    BEGIN
    INSERT INTO TEAM_MEMBERS(TEAM_ID)
    VALUES(:P75_TEAM_ID);
    END;
    When I try to insert a new record I get the following error:
    Error      ERR-1904 Unable to compute item default: type = Function Body computation_type= BEGIN INSERT INTO TEAM_MEMBERS(TEAM_ID) VALUES(:P75_TEAM_ID); END; .
    ORA-06550: line 5, column 2: PLS-00103: Encountered the symbol ";" when expecting one of the following: begin case declare end exception exit for goto if loop mod null pragma raise return select update while with << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe The symbol "exit" was substit
    Any ideas what I am doing wrong?
    Thanks!

    Brian - Sometimes whitespace at the end of the block causes this. Be sure to trim everything after the last semicolon including tabs and newlines.
    Scott

  • Does anyone know a way of making primary keys updatable in tabular forms

    Is there a way i can make my primary key updatable in a tabular form.
    I have two tables one called proposal details and one called student current details. Bascially you select one of your proposal details to become your current project this is done via the proposal id. The problem is that i cannot make this field editable in a tabular form. Does anyone know how i could make this primary key updatable?

    Hi Dan,
    One suggestion, perhaps, would be to base the tabular form on a View rather than directly off of the table. The view could include two instances of the proposal id field - the actual field and a second field called, say, PROPOSAL_ID_EDITABLE. You can then use an INSTEAD OF trigger on the view to update the actual table data with the value entered/selected in this second field.
    The reason why Apex will stop you updating primary keys is that it needs to be able to use these to get back to the original record to apply any changes. If you use a view instead, ensure that the primary key fields are not editable but allow the user to change a dummy field instead, the pk fields are available for Apex to get back to the data but the trigger will change the value instead.
    Regards
    Andy

  • Primary key in master detail form

    i have a situation where i need to access the value of primary key (primary key is hidden) in a master-detail form.
    i need to access the primary key in the javascript onClick event of the button. i'm using the following code in the ...before displaying the form event :-
    htp.p('<script language="JavaScript1.3">
    <!--
    function getField(form,fieldName)
    var objName = "";
    var tmp = "";
    var dAction = "";
    var sel_idx = 0;
    var cnt = 0;
    var instance = 0;
    var slicedName;
    var fillData = new Array();
    for (var i = 0; i < form.length; i++)
    slicedName = form.elements.name.split(".");
    tmp = slicedName[2];
    instance = parseInt(slicedName[3],10);
    if (!tmp)
    continue;
    objName = tmp;
    if (objName == fieldName)
    return form.elements[i].value;
    //-->
    </script>');
    and then i'm calling this javascript in onClick event of the button as follows :
    var_get_val = getField(this.FORM,'PROD_ID');
    this script works for a form with single block but, does not work with the master detail form.
    what is wrong here ... ??
    any ideas or suggestions ...??
    thanx a lot.
    null

    Thank you, Denes,
    but isn_t there a simplier way to use a third column ?
    I will keep your idea in mind and try out as soon as possible.
    With kind regards,
    Hergen.

  • ADF Create form : Invalid owner exception

    hi
    i hve a master details form
    i hve to insert in to three more tables
    i created Eo's and Vo's for each and the association and links were created accordingly
    i want this form as a single page
    ie
    now i have to treat every view object as seperate one in the page
    i need to keep one create button for each view object to initialize the create page
    i tried to do with invoke action in executables
    now i am getting an error while initing the second create form
    *oracle.jbo.InvalidOwnerException: JBO-25030: Failed to find or invalidate owning entity: detail entity EO_ActivityDt, row key oracle.jbo.Key[-7 ].*
    is it possible prepare a create form from multiple table together with single create action
    pls advice
    thanks

    try chaging the pre-allocation size value (toplink map->Database Info tab->Sequencing).
    If you are using Oracle db, also make sure that you database sequence increment and TopLink sequence preallocation sizes are the same.
    For more info refer to http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/_html/prjdaun007.htm
    Re: Toplink Sequence - Preallocation in Oracle
    Hope this helps,
    Anuj

  • ADF Create Form - will compensate

    I figured in as much as I am willing to learn and transition to ADF, I am not going to waste any more time on this create form. I am not sure if this is the right forum for this, but I am willing to compensate somebody who's willing to develop something that's working. It's a simple create form guys and I know that a lot of folks on this panel can nail it down in 30 mins or so. But I am not there - yet!
    If you are interested in further details please email me at [email protected] and I will provide you with the specs.
    P.S. Please guys keep in mind that this is a personal effort so it's nothing big. But its going to be worth your 30 mins or 1hr that's going to take you to develop the form.
    Thanks

    Nyanga,
    I was looking at your other post today regarding a create form. I think I may have something that is similar to what you are trying to do; before posting, let me explain what my JSF does, and you can comment.
    I have a JSF that is used to insert/update information in a single database table. Based upon one of the fields, let's call it field1 - other fields are displayed/cleared. For example, if field1 = "A" the user sees fields 2, 3, and 4, and fields 5, 6, and 7 are hidden (and internally set to null in the database record). Conversely, if field1 = "B" the user sees fields 5, 6, and 7, and fields 2, 3, and 4 are hidden (and internally set to null in the database record).
    Is this similar to your use case? If so, I can post a blog entry about it - it's really not to difficult.
    John

  • ADF Create form

    hai ,
    i have one master detials form . i hve to insert in to three tables say cutomer master , customer personal details , Customer contact
    i have created entities ,associations and view objects , View Links for 3 tables and added to app module
    I just drag n drop the view objects to create a form
    Here i need to call *3 Create methods* of each View Objects to to init the create form
    and while Saving it shows error for customerid  in Cusomer Personal Details Table which should be inserted from the customer master table using View link /Association
    Pls advice

    hi timo
    i hve created as follows ,
    Created Eo's for 3 Tables n then Associations were created automaticaly with reference to Forign key constraints
    and Created the VO's for each n View Liks are created based on associations
    and added to app module
    i drag n drop the three VO's to create master form say vo1,vo2,vo3
    for each vo it have its own create method
    Now i tried
    1)
    with 3 create buttons
    ie i should click Create button 1 to init the fiirst table attribute n second button to init the second table attr n so on
    its working
    2)
    i hve added those three create method to page def executables its showing error for row key
    3)
    i tried with 1 backing bean and call the three create methods in the button action
    its showing error like
    oracle.jbo.InvalidOwnerException: JBO-25030: Failed to find or invalidate owning entity: detail entity EO_ActivityDt, row key null.
    *" Failed to find or invalidate owning entity: detail entity EO_ActivityDt, row key null.*
    *Failed to find or invalidate owning entity: detail entity EO_CorrespondenceHd, row key null. "*
    pls advice
    thanks

  • Primary Key Issue With Creating Tables

    Hi,
    I have the following scripts to create my two tables in oracle 10g, i was wondering wether or not i had correctly set up my primary key or if there is a better way of doing it than the way i have.
    Here are my two scripts for my tables:
    CREATE TABLE CUSTOMER (
    fname varchar2(15) NOT NULL,
    lname varchar2(20) NOT NULL,
    age varchar2(3) NOT NULL,
    custAreaCode number(5) NOT NULL,
    custNumber number(6) NOT NULL,
    constraint cust_pk PRIMARY KEY (custAreaCode),
    constraint cust_pk2 PRIMARY KEY (custNumber),
    constraint age_chk CHECK (age >=18 AND age <150)
    CREATE TABLE PHONECALL (
    startDateTime smalldatetime NOT NULL,
    custAreaCode number(5) NOT NULL, ---Reference PK From Customer Table
    custNumber number(6) NOT NULL, ---Reference PK From Customer Table
    dialledAreaCode number(5) NOT NULL,
    dialledNumber number(6) NOT NULL,
    crgPerMinute number number (3,1) NOT NULL,
    endDateTime smalldatetime NOT NULL));
    I am not sure if i have referenced the primary keys correctly in the PHONECALL table.
    Thanks in advance :)

    Hi,
    You want like this below ? I think that smalltime data type is not a valid type. Other thing, this is not a rule, but I advice you to put the primary key columns as the first columns of your table. One question: There is no PK on the phonecall table ?
    SGMS@ORACLE10> create table customer (
      2  custareacode number(5) not null,
      3  custnumber number(6) not null,
      4  fname varchar2(15) not null,
      5  lname varchar2(20) not null,
      6  age varchar2(3) not null,
      7  constraint cust_pk primary key (custareacode),
      8  constraint cust_uk unique (custnumber),
      9  constraint age_chk check (age >=18 and age <150)
    10  );
    Table created.
    SGMS@ORACLE10> create table phonecall (
      2  custareacode number(5) not null constraint fk_phone_cusarecode_customer references customer,
      3  custnumber number(6) not null constraint fk_phone_custnumber_customer references customer,
      4  startdatetime date not null,
      5  dialledareacode number(5) not null,
      6  diallednumber number(6) not null,
      7  crgperminute number (3,1) not null,
      8  enddatetime date not null);
    Table created.
    SGMS@ORACLE10> select table_name,constraint_name,constraint_type from user_constraints
    2 where table_name in ('CUSTOMER','PHONECALL') and constraint_type in ('P','U','R');
    TABLE_NAME                     CONSTRAINT_NAME                C
    CUSTOMER                       CUST_PK                        P
    CUSTOMER                       CUST_UK                        U
    PHONECALL                      FK_PHONE_CUSARECODE_CUSTOMER   R
    PHONECALL                      FK_PHONE_CUSTNUMBER_CUSTOMER   RCheers

Maybe you are looking for