Form Validation on Complex Primary Key

I have a that inserts/updates a table with a 2 coulmn primary key (ticket_num, ticket_seq). Is there anyway to create a page validation item that will keep users from violating the pk constraint and getting the ugly ORA-00001 error.
I think I just don't understand the syntax of the "SQL Expression" validation.
I would like to just find if the key already exists, but the following does not seem to catch it. I have put the following in validation expression 1.
(select count(*)
from system_issue_timings
where ticket_num = :P3_TICKET_NUM
and ticket_seq = :P3_TICKET_SEQ) > 0

The pl/sql with count(*) above will not work as select count(*) into... will never raise no_data_found, it will result in zero in v_test.
The other thing to watch out for on this type of validation (whether implemented as sql not exists or as a pl/sql returning boolean or pl/sql returning error) is that if you are doing updates on this page then you need to either :
1. not fire the validation when updating (assuming you cannot modify the primary key columns on the page), or
2. specifically exclude the row being updated from the validation lookup (using rowid for example) as otherwise it will satisfy the condition and fail the validation.
You want to probably use 'sql NOTexists' validation as it "Passes if the query return no rows." :
select 1
from system_issue_timings
where ticket_num = :P3_TICKET_NUM
and ticket_seq = :P3_TICKET_SEQ
Glen
Edited by: gjmorris on Sep 24, 2008 1:02 PM - added actual solution.

Similar Messages

  • Automated Row Fetch for complex primary keys

    I would like to post a workaround for using automated row fetch on tables with a complex primary key (more than 2 components).
    APEX has the restriction of just beeing able to handle <= 2 PK components, which is not acceptable to me in quite a lot of scenarios.
    Imagine a situation where you want to manage recipes for dishes. Each recipe has several versions and each version has several recipe-positions. The PK consists of recipe_id, recipe_version and recipe_position.
    You hava a report displaying the positions of a specific recipe version and this report contains an edit link that jumps to a form, where the attributes of a recipe position can be edited.
    Creating the edit position form, you can only specify a primary and a secondary key item/column. Given that, if you want to use the edit form by clicking the edit link, you will receive the error "ORA-01422: exact fetch returns more than requested number of rows", because the third PK compound is not used as a restriction.
    The workaround is to present the ROWID pseudo-column to the form as the primary key.
    Create a (hidden) Item to store the ROWID-Value of the current row and simply change the properties of the ARF-Process to accept ROWID as the PK column and specify the corresponding item.
    If automated processing of recipe_position is desired, you can specify it as the secondary key column.
    I don't know if this woraround/solution is very ugly, but it works ...
    Ingo

    Hello Ingo,
    I tend to avoid ROWID. In the Interactive Report it's used too.
    The ROWID can change, where a Primary Key normally doesn't change, that's the biggest thing I worry about. How does Oracle know not somebody else already updated the row?
    I always wonder what happens when you're in a cluster/RAC and use ROWID. Isn't it possible that you get two rows for the same rowid?
    Just my thoughts.
    Regards,
    Dimitri
    -- http://dgielis.blogspot.com/
    -- http://apex-evangelists.com/
    -- http://apexblogs.info/

  • Automated row fetch / Complex primary key

    I have a complex primary key made up of ticket_num, ticket_seq because there may be between 1-3 rows associated with one ticket_num.
    The problem I am having is the automated row fetch errors out when trying to update a ticket with the following error even though the combination of ticket_num, and ticket_seq are unique, and ticket_num, ticket_seq are entered in the automated row fetch as primary key column, and secondary key column.
    ORA-01422: exact fetch returns more than requested number of rows
    Is there a way to put both columns as the primary key?

    Thanks, Scott. I had the exact same problem, and your suggestion fixed it.
    May I suggest that this is a bug in Apex? In the create application wizard, select "Add Page" -> "Report and Form", and select a table with a compound primary key consisting of two columns. Apex will create the report and the form, and will configure the ARF correctly in the form, but it does not specify a value for the second key in the Link Column section of the report attributes.
    Thanks,
    Mike

  • Source tables for forms and tabular forms must have a primary key.

    Why does HTML DB 2.0 return the message
    "Source tables for forms and tabular forms must have a primary key."
    when trying to generate a "Report and Form" page based on a view defined like "create view <applicationschema>.a as select * from <sourceschema>.b" ?
    It should be possible for HTML DB to "see" that the table "<sourceschema>.b" already has a primary key.
    bw - Christian

    Christian,
    In the create application wizard, when creating form or tabular form pages, you can only use tables with primary keys, and not views, because that wizard is automatically deriving the primary key from the table definition. If you want to build forms on views or tables without a primary key, you need to use one of the create form wizards while working on an existing application. Those wizards allow you to pick your own column as a primary key column.
    Regards,
    Marc

  • Master Detail Forms with 2 composite primary keys - Is there a workaround?

    Hello All,
    I have been searching for a workaround to the maximum 2 part primary key restriction on the multi-row updates, and master-detail forms, and am hoping that someone can help me. I am using HTMLDB v2.0.0.00.49 with IE 6 against a 9.2 DB.
    I successfully implemented the workaround of Fred Stoopendaal's (see Updata PK on HTML DB ) and it works fine for single page multi-record updateable forms, but alas I haven't been able to extend it to master detail forms (I think it is something to do with Oracle not allowing the "returning" clause on views).
    Here is what I tried:
    two tables, one with a 2 part composite primary key, which is the master table, and a detail table with 3 part composite primary key -
    --------- BEGIN SQL ---------
    create table master_table
    ( master_col1 number
    , master_col2 number
    , master_col3 varchar2(30)
    , constraint master_pk primary key (master_col1,master_col2));
    create table detail_table
    (detail_col1 number
    ,detail_col2 number
    ,detail_col3 number
    ,detail_col4 varchar2(30)
    , constraint detail_pk primary key(detail_col1,detail_col2,detail_col3)
    , constraint master_detail_fk foreign key (detail_col1,detail_col2) references master_table(master_col1,master_col2));
    create or replace view v_master_table as
    select rowid mata_rowid,mata.*
    from master_table mata;
    create or replace view v_detail_table as
    select rowid deta_rowid,
    (select rowid from master_table mata where mata.master_col1 = deta.detail_col1 and mata.master_col2 = deta.detail_col2) deta_mata_rowid
    , deta.*
    from detail_table deta;
    create or replace trigger mata_ins_upd_trg
    instead of insert or update on v_master_table
    referencing new as new old as old
    for each row
    begin
    if inserting then
    insert into master_table (master_col1, master_col2, master_col3)
    values (:new.master_col1, :new.master_col2, :new.master_col3);
    end if;
    if updating then
    update master_table
    set master_col1 = :new.master_col1,
    master_col2 = :new.master_col2,
    master_col3 = :new.master_col3
    where rowid = :old.mata_rowid;
    end if;
    end;
    create or replace trigger deta_ins_upd_trg
    instead of insert or update on v_detail_table
    referencing new as new old as old
    for each row
    begin
    if inserting then
    insert into detail_table ( detail_col1, detail_col2, detail_col3, detail_col4)
    values (:new.detail_col1, :new.detail_col2, :new.detail_col3, :new.detail_col4);
    end if;
    if updating then
    update detail_table
    set detail_col1 = :new.detail_col1,
    detail_col2 = :new.detail_col2,
    detail_col3 = :new.detail_col3,
    detail_col4 = :new.detail_col4
    where rowid = :old.deta_rowid;
    end if;
    end;
    --------- END SQL ---------
    Then I created a master-detail form in Apex on the two views, using the mata_rowid and deta_rowid as primary keys, and mata_rowid=deta_mata_rowid as the link. I realise that using a function to fetch the master rowid within the detail view query is costly, but it was my intention to modify the record fetch queries to use the real FK columns once things were up and running.
    It seems to generate the pages ok, and I can insert/update master table records, but as soon as I modify records in the detail table things go a bit haywire. I can't find any documentation on how the inbuilt MRU/MRD logic works, so can't figure out the issue.
    Can anyone out there tell me what the problem is with the logic above, or if they have come up with a neat solution to this annoying limitation. I know that many will say that I should modify the data model to use surrogate primary keys, but many of the uses for HTMLDB are new interfaces for old schemas, so a workaround that doesn't involve wholesale data model changes would be preferable.
    Thanks in advance,
    Mike Cretan

    Hi, this is likely not the most elegant way...but perhaps the simplest -- and I didn't have much time to play.
    I used Wizard to create two separate Master Detail forms, each with a separate detail table. Thus I ended up with four pages:
    Page "A" - "Selector" page for Master (Report), with Edit link driving to Detail-1
    Page "B" - Editable Master/Detail-1 page (HTML / Report)
    Page "C" - "Selector" page for Master (Report), with Edit link driving to Detail-2
    Page "D" - Editable Master/Detail-2 page (HTML / Report)
    Then I selected the primary key column TWICE on the Report on Page A. Modified the second instance of this column to navigate to Page D (passing primary key) exactly the way the original instance of this column navigates to Page B. Then I deleted Page C.
    Since you can have only one Tabular Entry form per page, this seemed the best way to drive two separate detail tables from a common interface.

  • Insert values in multiple tables. One of the tables has complex primary key.

    Hello, I am using Jdeveloper version 11.1.2.3.0
    I have a table FORM_TYPE and another table Str. The Str table is used to translate strings from the table name which are read from another program from the database and used to generate forms..
    The FORM_TYPE  table has a relation to the STR table via formtype.title_str_id = str.str_id.
    The STR table has a primary key that is depending on mf_language and str_id columns. I generated entity for the STR table but can't insert from the application module new values for some reason... It says the record invalidates its own entity..
    I am trying to create a table that will be editable and will have the columns Description, Name, Str in English, Str in French etc...
    Want to create a Form_Type and in the same time to insert new values for each language... But can't make the inserts of the new STR work..
    Also the    FormType.TITLE_STR_ID has many values null already in the database.
    SELECT FormType.DESCRIPTION,
           FormType.FORM_TYPE_ID,       
           FormType.NAME,
           FormType.PAPER_REPORT_FORMAT,
           FormType.PAPER_REPORT_NAME,
           FormType.TITLE_STR_ID,
           en.str en_str,
           en.str_id,
           en.object_name en_object_name,
           fr.str,
           fr.str_id,
           fr.object_name,
           du.str,
           du.str_id,
           du.object_name,
           bg.str,
           bg.str_id,
           bg.object_name      
    FROM FORM_TYPE FormType,
    (select str.str_id, str.mf_language_id, str.str, str.object_name
    from mf_language ml,  str
    where ml.mf_language_id = str.mf_language_id
    and ml.code ='en') en
      , (select str.str_id, str.str, str.object_name
    from mf_language ml,  str
    where ml.mf_language_id = str.mf_language_id
    and ml.code ='fr') fr,
      (select  str.str_id,   str.str, str.object_name
    from mf_language ml,  str
    where ml.mf_language_id = str.mf_language_id
    and ml.code ='du') du,
      (select  str.str_id,  str.str, str.object_name
    from mf_language ml,  str
    where ml.mf_language_id = str.mf_language_id
    and ml.code ='bg') bg
    WHERE
    formtype.title_str_id = en.str_id and
    formtype.title_str_id = fr.str_id and
    formtype.title_str_id = du.str_id and
    formtype.title_str_id = bg.str_id  

    Tried that I made view links and associations but still can't insert in both tables at once... Could be because the tables aren't having relationship between them or because the STR table has a (STR_ID, MF_LANGUAGE_ID) primary key...

  • Tabular form- button to save primary key to variable?

    Hi guys. I have a tabular data block that has results. Now I have put a command button next to each record. How would I go about when I click the button, it actually refers to that record?
    I have put the buttons on (when you put it on with the data block, it puts a button on for every row). I need to save the primary key number into a global variable depending on the record button clicked.
    Thanks guys

    Hi Lockmac,
    Why've you made button for every record? I've never seen such a form.
    We normally create a single save button at the bottom to save any changes.
    You can definitely save a record by pressing any of your buttons but i think it is not possible to associate button to a particular record (as the way you want).
    You can use :system.trigger_record to identify the current row that oracle forms is processing. May be you can use this to build your logic.
    Please mark answer as helpful / correct, if it helps you
    Navnit
    Edited by: Navnit Punj on May 6, 2009 9:53 PM

  • Apex Form - how to enter primary key value manually?

    Hi
    Whenever I am creating Apex form using wizard, it asks me to specify trigger/sequence/pl/sql function for populating primary key value.
    However, if I want to specify primary key myself (ie. not auto generated number), how I can specify that?
    Thanx

    Hello,
    By Yourself you mean : by hand or by a pl/sql?
    If you say by trigger, the system doesn't care about what number is send. So you can give it "manually"
    May I ask what is the reason of that?
    Cheers,
    Arnaud

  • Can we create an APEX Form based on Table which has no Primary Key

    Hi,
    I have a requirement.
    I need to create a FORM based on a table having no Primary Key but it is having Unique Key . I can use Unique Key as an alternate of Primary Key.
    but When I tried to create a Form, I got the following message.
    Source tables for forms and tabular forms must have a primary key
    Thanks,
    Deepak

    Deepak_J wrote:
    Hi,
    I have a requirement.
    I need to create a FORM based on a table having no Primary Key but it is having Unique Key . I can use Unique Key as an alternate of Primary Key.
    but When I tried to create a Form, I got the following message.
    Source tables for forms and tabular forms must have a primary key
    Thanks,
    DeepakGood database design will always require a PK on the tables. There are only very few and rare expetions to this rule. One would be when you have store the data only temporarily in this table, like it is often done for import/loader tables. The data is first loaded in the "import"-table, then validated and then transported to the "real" tables. In such a scenario you can ignore the primary key on purpose. Because you already have a UK on this table it can't be such a scenario.
    For most other scenarios you should always add a PK. Ask critically why there is no PK on it. Is there a reason for it or was the table designer just not doing its job well?
    Btw: A UK is identical to a PK if the column is mandatory (NOT NULL). In this case you could simply change the constraint from UK to PK.

  • Validation on Primary Key value in TMG

    Hi,
    I have a  custom table with field Outcome_id as primary key. I have to put some validation on this primary key value.
    For the above I hv used a TMG Event '01' and written the code for validating the values.
    On save when validation fails the primary key field gets disabled even though entry is prevented from being saved.Since the value of the primary key cannot be changed the validation fails recursively.
    How cn I keep the primary key fields enabled when the validation fail.
    Rgds,
    Swati.

    Hi,
    As per basic Module pool programming a screen field gets disabled after throwing an error.
    You will have to use Field statement in the module pool program generated for your tables TMG and modify it.
    But please note- any time TMG is regenerated all changes are lost.
    "refering sap help "
    Checking Single FieldsIf you send a warning or error message from a module mod  that you called using a FIELDstatement as follows:
    FIELD f MODULE mod.
    the corresponding input field on the current screen is made ready for input again, allowing the user to enter a new value. If the field is only checked once, the PAI processing continues directly after the FIELDstatement, and the preceding modules are not called again.
    refer this :
    [http://help.sap.com/saphelp_nw04s/helpdata/en/9f/dbaa4735c111d1829f0000e829fbfe/content.htm]
    Edited by: sap_wiz on Jun 22, 2011 5:20 PM

  • How shall we do validation for Unique Key and Multiple Primary Key?

    Hi,
    I have table created From EO in which one column is checked as Unique.
    How to do validation for column checked as Unique.
    I know how to do validation for column checked as primary key.
    Below is sample code for primary key validation
    if (getRvSize() != null)
    throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,
    getEntityDef().getFullName(), // EO name
    getPrimaryKey(), // EO PK
    "RvSize", // Attribute Name
    value, // Attribute value
    "AK", // Message product short name
    "FWK_TBX_T_EMP_ID_NO_UPDATE"); // Message name
    if (value != null)
    OADBTransaction transaction = getOADBTransaction();
    Object[] rvKey = {value};
    EntityDefImpl rvDefinition = xxczVAGCSRVSizingEOImpl.getDefinitionObject();
    xxczVAGCSRVSizingEOImpl rv =
    (xxczVAGCSRVSizingEOImpl)rvDefinition.findByPrimaryKey(transaction, new Key(rvKey));
    if (rv != null)
    throw new OAAttrValException(OAException.TYP_ENTITY_OBJECT,
    getEntityDef().getFullName(), // EO name
    getPrimaryKey(), // EO PK
    "RvSize", // Attribute Name
    value, // Attribute value
    "AK", // Message product short name
    "FWK_TBX_T_EMP_ID_UNIQUE"); // Message name
    What changes need to be done for above code in order to do the validation for Unique Key.
    I have one more Question
    How shall we do the Validation for Multiple Primary Key in a table?
    - Mithun

    1. If you just validate on one attribute like your unique key, then put your logic in the set<Your AttributeName) method
    2. If you want to do the cross validation ( like validating multiple attributes) then put your logic in the validateEntrity Method
    How to do that?
    1. Create a Validation View object.
    2. Associate your VVO to the VAM
    3. Create entity expert.
    4. Have method in entity expert for your validation (you would be calling AM and then VO execute the query and do the validation.
    5. You would be calling the Entity experty method from your EO either setMethods or validateEntity.
    I have given just the high level points.
    Hope this helps.
    Thanks,
    RK

  • Primary key issue with adf Entry Form.

    Hi All,
    i'm using jdev version 11.1.1.5.0
    use case: i have create simple entry form based on Eo and Vo using database table like student(enrollment no,name address)
    where enrollment no is primary key.
    so when i have create a record i have set enrollment no in entity impl class of this eo create method using some logic based on my need like(20130001)
    for that i have read highest no from database field and assign to enrollment no field when user create record.
    so when user create record second time then enrollment no is 20130002. and other detail like name and address user fill and commit record. and it is fine.
    but problem is that when two user access same form at a time and create record so both have get same primary key like 20130003 because in current time in database maximum value is 20130002.
    so which user  commit record first it record will save on database and second user get error message because of primary key violation.
    so my question is that where we generate primary key value for record so when multiple user access form have get different primary key value. and in my use case i can't use sequence and any autoincrement no
    because i have patter for primary key.
    Thanks in Advance
    Manish

    Hi,
    Dimitar and Frank
    thank for reply.
    How can i apply non-concurrent DB lock can you please explain.(because lock method on entity impl not work when user create new row as per documentation)
    http://docs.oracle.com/cd/B14099_19/web.1012/b14022/oracle/jbo/server/EntityImpl.html#lock__
    i have write following line of code in entity impl class to set primary key value(reqid)-
        @Override
        protected void prepareForDML(int i, TransactionEvent transactionEvent) {
             super.prepareForDML(i, transactionEvent);
            this.setReqid(genReqid());
        public String genReqid() {
            String reqby = this.getReqby();
            String qry =
                "SELECT nvl(MAX(TO_NUMBER(SUBSTR(REQID,7))),0)+1  FROM STM_REQHDR WHERE REQBY=? AND REQTYPE<>'M' and substr(reqid,1,2)<>'MT' AND SUBSTR(REQID,1,3)<>'PAY'";
            PreparedStatement ps = null;
            String no = "";
            try {
                ps = getDBTransaction().createPreparedStatement(qry, 0);
                ps.setString(1, reqby);
                ResultSet rs = ps.executeQuery();
                if (rs.next()) {
                    no = rs.getString(1);
                ps.close();
            } catch (Exception e) {
                System.out.println("Exception in Gen req id ==>" + e);
            String reqno = reqby + String.format("%6s", no).replace(' ', '0');
            return reqno;
    but when i run form in debug mode and two user commit concurrent manner only one time code block is executed who first commit. and second user got error message.
    thanks
    Manish

  • How to handle the unique primary key validation when is a multipart key !

    I dont know how to handle the primary key validation when the primary key is a multipart key.
    Besides would like to know how to catch the TooManyObjectsException in order to custom the default exception message.
    thank u.
    regards,
    Orlando Acosta

    Are you using EJB's, Toplink, or BC4J?
    Thanks,
    Rob
    Team JDev

  • Too many objects match the primary key oracle.jbo.Key

    Hi OAF Gurus,
    Currently we are implementing R12 Upgrade , for this we have deployed all the custom OAF Application related files on to the the respective JAVA_TOP folder.
    We have a custom municipal postal application which tracks the Postal Details.
    The page runs perfectly fine without any error in 11i instance, but the same is erroring out In R12.
    In R12 it shows an error as Too many objects match the primary key oracle.jbo.Key[112010 2014-10-01]
    here 112010 is nothing but the postal code id and 2014-10-01 is the Effective Start Date
    We have a custom table as xxad_postal_codes_f  (Date Track table)which contains the postal_code_id and effective_start_date (primary key is combination of postal_code_id and effective_start_date ).
    The Table already contains a row for postal_code_id = 112010  and Effective_Start_date = Sysdate.
    Now we want to update the entry for the same postal code with the Id being same as 112010  and  Effective_Start_date as 2014-10-01 through custom PostCodeChangePG
    at the time of save we are getting an error as Too many objects match the primary key oracle.jbo.Key[112010 2014-10-01]
    The table doesn't contain any of the data mentioned ([112010 2014-10-01]) at the time of insertion, hence there should not be any duplication of primary key but still we are getting the error.
    Please let us know how can we handle this..?
    Below is the code which is getting called on Click of Save button of PostCodeChangePG
    if (pageContext.getParameter("Apply") != null)
          PCodeCoWorkerBase coWorker = getCoWorker(pageContext, webBean);
              coWorker.processApply();
    Code in PCodeCoWorkerBase
        public void processApply()
          String postalCodeId = UIHelper.getRequiredParameter(pageContext, "postalCodeId");
          Date startDate = UIHelper.getRequiredDateParameter(pageContext , "EffectiveStartDate");
         Serializable[] postalCodeData = (Serializable[]) applicationModule.invokeMethod( "insertPostalCodeMajorChange", params, paramTypes );
          finalizeTransactionAndRedirect( postalCodeData );
    Code in Application Module
      public Serializable[] insertPostalCodeMajorChange ( String postalCodeId, Date date )
        PCodeAmWorker amWorker = new PCodeAmWorker(this);
        return amWorker.insertMajorChange( postalCodeId, DateHelper.convertClientToServerDate( getOADBTransaction(), date )
    Code in PCodeAmWorker
      public Serializable[] insertMajorChange ( String postalCodeId, Date date )
        // Get the view objects we need from the application module
        OAViewObject viewObject = (OAViewObject) applicationModule.getPCodesVO();
        PCodesVORowImpl currentRow = (PCodesVORowImpl) viewObject.getCurrentRow();
        currentRow.validate();
        currentRow.setEffectiveStartDate(date);
        currentRow.setComment1(currentRow.getNewComment());
    // Create a new row based on the current row
    PCodesVORowImpl newRow = (PCodesVORowImpl) viewObject.createAndInitRow(currentRow); //This is failing out and gives the error
    // Get the new effective start date as entered by the user
    Date effectiveStartDate = currentRow.getEffectiveStartDate();
        // Calculate the previous period's effective end date
        Date previousEffectiveEndDate = DateHelper.addDays(effectiveStartDate, -1);
        // Refresh the current row (the one changed by the UI) with the data it had at the beginning of the transaction
        currentRow.refresh(Row.REFRESH_UNDO_CHANGES);
        // The current row will now represent data for the the previous period set the effective end date for the previous period
        currentRow.setEffectiveEndDate(previousEffectiveEndDate);
        // Insert the newly created row that now represents the new period
        viewObject.insertRow(newRow);
        applicationModule.apply();
        return generateResult(newRow);
    PCodesVO() is based on PostalCodeEO
    below is the code from PostalCodeEOImpl
      public void create(AttributeList attributeList)
        // NOTE: This call will set attribute values if the entity object  is created with a call to vo.createAndInitRow(..)
        super.create(attributeList);
        if (getPostalCodeId() == null)
          setPostalCodeId(getOADBTransaction().getSequenceValue("XXAD_POSTAL_CODES_S"));
        if (getEffectiveStartDate() == null)
          setEffectiveStartDate(getOADBTransaction().getCurrentDBDate());
    After diagnosing the issue we found that the error is on the code of AMworker file while creating a new row PCodesVORowImpl newRow = (PCodesVORowImpl) viewObject.createAndInitRow(currentRow);
    we tried so many things such as clearing entity cache, VO cache, validating for duplicate primary key but still not able to resolved this.
    Please advice how to insert a new row on the PCodesVORowImpl without any exception.
    Thanks,
    Pallavi

    Hi ,
    One question here , if you are udating a existing record then why you are trying to create a new row
    PCodesVORowImpl newRow = (PCodesVORowImpl) viewObject.createAndInitRow(currentRow);
    Thanks
    Pratap

  • Determining the row id or primary key columns and values genericaly

    Hi There
    Does anyone perhaps know how to determine the rowid of the
    currently selected row in a form, or alternatively the primary
    key values/columns?
    Regards
    Herman

    Hi Tranen,
    you can view the constraints and respective columns by setting the
    Table Shape Properties in the Property Inspector.
    Select (all) the tables on the Diagram you want
    In the Property Inspector,under Constraints -Set the 'Show Constraint Columns' to 'True',
    Set 'Show Constraints' to 'True' .
    Constraints (PK,UK,FK,Check)
    Also Set the 'Show Columns' option to 'False' .This will be under display options in the Property inspector.
    This should modify the Table shape in the diagram as follows:
    <Table name>
    <PK> PKName:Column1,Column2
    <UK>UKName:Column3
    <FK>FKname:Column1
    are you looking for the same?
    Thanks.

Maybe you are looking for