BC4J models foreign key associations as 1-to-1 instead of 1-to-many

I've been using JDeveloper to generate a BC4J layer against a schema for several months as the schema has evolved. It has always modeled foreign key associations as 1-to-many, but now it is suddenly modeling foreign keys as 1-to-1, which is nonsense. A lot of other associations are also wrong.
This happened to a schema that we've been using JDeveloper/BC4J on for months with no such problems as the schema has evolved. The database has changed slightly, but there was no change made to the particular constraints that are now modeled incorrectly.
If I point JDeveloper to an older version of the same schema it generates the correct 1-to-many relationship. Something in the latest schema must be throwing JDeveloper/BC4J off.
What do I have our data modelers look for in this case?
Why would BC4J ever model a foreign key association as 1-to-1?

I've been using JDeveloper to generate a BC4J layer against a schema for several months as the schema has evolved. It has always modeled foreign key associations as 1-to-many, but now it is suddenly modeling foreign keys as 1-to-1, which is nonsense. A lot of other associations are also wrong.
This happened to a schema that we've been using JDeveloper/BC4J on for months with no such problems as the schema has evolved. The database has changed slightly, but there was no change made to the particular constraints that are now modeled incorrectly.
If I point JDeveloper to an older version of the same schema it generates the correct 1-to-many relationship. Something in the latest schema must be throwing JDeveloper/BC4J off.
What do I have our data modelers look for in this case?
Why would BC4J ever model a foreign key association as 1-to-1?

Similar Messages

  • Data Modeler foreign key names

    Hi,
    I've been using Data modeller for a while now and it works beautifully, anyhow there is an issue I would appreciate if anybody can help me in.
    For foreign keys, if the master table primary key is names ID, the foriegn key will be ID also, and if already there is an ID column column in the detail table, it will be ID1, ID2 ....
    Can I change the naming method to be like the oracle designer, or any convention I would like ??
    Thanks
    AK

    I'm using the Logical Model V 1.5.1Paul,
    it's pre-production release. Data Modeler is free now and you can download current published release - it.s version 2.0.0.584.
    There is "Attributes" page in relationship dialog (version 2.0) and you can see attributes generated by that relationship.
    For foreign keys in relational model - there is "Associated columns" page, you also can see referred key there.
    Naming templates for FK columns and attributes can be defined in version 2.0.0.584.
    Philip

  • Why do you expose the accessors of a foreign key association in an Entity?

    Hello Everyone:
    I am working on our re-usable Business Components .jar file. I am re-doing the one we had created in 10g from scratch in 11.1.2 in order to utilize all of the features of 11.1.2 and remove the problems we were having with re-factor in 10g.
    In 10g there was also a bug that gave us an error if we exposed the source and destination accessors of foreign keys if there were multiple similarly named source accessors for a number of foreign keys on a table. So we removed all the foreign key source and destination accessors. We only exposed the accessors for parent/child relationships and uniquely named them eg. Person_parent_to_PersonAddress. We have used a number of these parent/child accessors in customized coding logic, but not the foreign key accessors.
    Is anyone using the foreign key accessors and what function are you using them for? In moving forward with starting this re-usable Business Components .jar file, I am trying to determine if we should be exposing the foreign key source and destination accessors.
    Thanks in advance for any replies.
    Mary
    UofW

    Many thanks for the response. Don't think I can make use of synchronous replication with lookup tables given our own requirements.
    I was thinking however, by employing a hub-and-spoke replication model instead of an N-WAY, that this would avoid foreign key conflicts altogether.

  • SQl*Modeler - foreign key amendment error

    SQl*Modeler 2.0.0 Build 584 (Windows)
    Oracle 10.2.0.4 Solaris
    If I change an existing foreign key to simply change the delete rule (from say CASCADE to RESTRICT) it changes in memory just fine. If I generate the DDL the change has happened and I get the expected DDL.
    However, I then save the model, exit SQL*Modeler, start SQL*Modeler and check the foreign key the change has been lost.
    I can workaround this by changing the name of the foreign key and the change is saved correctly. Feature ?
    Ian

    Hi Ian,
    I logged bug for that.
    You can use foreign key dialog to do that change without need to change the name - just double-click on FK line or presentation in the browser.
    Philip

  • SQL Developer Data Modeling: Foreign key checkbox

    Foreign key checkbox is disabled on all my attributes on every entities.
    I'm talking about logical model. How can I make an attribute that will be a foreign key?

    Hello,
    no chance for that. Foreign key attributes are created/removed automatically when attributes are added/removed to related primary key (identifier). We are criticized for having them at all.
    There is an option related to their names in Tools>General Options>Model>Logical.
    Best regards,
    Philip

  • BC4J/JSP:Foreign Keys:Read Only Renderers

    I've read and implemented all of the Renderers in the Renderer how to document. I've also read 8 pages of postings to this forum regarding renderers and LOVs. And I've read reams of BC4J class documentation.
    Though the EditRenderer that does a lookup via a SQL query works well, there is no equivalent Read-only (via a SQL query) Renderer example.
    I have tried to use the examples to create a Read-only (SQL based) Renderer but I haven't had much luck.
    The closest I got to a solution was an indicator that another poster accomplishes this by modifying the generated JSP. This is clearly the wrong place to implement this functionality (doesn't allow for code re-use).
    I was also able to use the DynamicEditRenderer as a Read-Only Renderer but that would confuse my users and create bugs.
    It was my idea that you shouldn't have to define the SQL and that you could use existing BC4J classes to lookup the friendly FK value. I looked through the XML files for View Objects and View Links and saw all the information required to do this. A smart person (obviously much smarter than me), should be able to create a read-only and Edit Renderer that doesn't require a SQL property or the PK or column properties (use the UK from the db).
    Does someone have an example of a Read-Only, SQL based, Renderer? Better, has someone written a generic renderer that can track back through View Links to find the UK in the lookup table?
    This is incredibly basic functionality that I'm surprised is missing from JDeveloper.
    Please help.
    Thanks, George

    You are not going to find an 'exact' match in our existing classes. The rednering HOWTO(http://otn.oracle.com/products/jdev/howtos/jsp/renderers.html) provides enough information for implementing your readonly lookup field. If you look at the first renderer in this document, it uses a static lookup list. You can easily use a secondary view object for your lookup values. Here is the code from that document:
    package myrenderers;
    import oracle.jdeveloper.html.ReadOnlyField;
    import oracle.jbo.Row;
    import oracle.jbo.AttributeDef;
    import java.util.StringTokenizer;
    public class ListFieldRenderer extends ReadOnlyField
    public ListFieldRenderer()
    public String renderToString(Row row)
    setValueFromRow(row);
    AttributeDef aDef = getAttributeDef();
    String sAttrValue = getValue();
    String sList = (String)aDef.getProperty("DISPLAY_LIST");
    if(sAttrValue != null && sList != null)
    StringTokenizer tokens = new StringTokenizer(sList, ",", false);
    while(tokens.hasMoreTokens())
    String sEntry = tokens.nextToken();
    String sValue = sEntry.substring(sEntry.indexOf('=') + 1);
    String sKey = sEntry.substring(0, sEntry.indexOf('='));
    if(sKey.equals(sAttrValue))
    return sValue;
    return super.renderToString(row);

  • Basic doubt about Primary Keys/Foreign Keys in Oracle Tables

    Hi,
    I have a doubt whether Primary Keys/Foreign Keys are allowed in Oracle or not. I have been informed that Oracle does not encourage having Primary Keys/Foreign keys in its database tables. Instead it urges users to have unique constraints on the requisite columns.
    However if I go to the ETRM and look for information about some of the Oracle Tables, I am informed that Primary Keys do exist. At the same time, I am being told that ETRM is not a reliable way of having correct information about table structure (at least the Primary Key information).
    It would be nice if any one of you provides me with some insight in this. Any pointers to a document would be welcome.
    Thanks

    FYI,
    There is seprate forum for Core Sql quieries
    PL/SQL
    Thanks

  • Tracking down which unindexed foreign keys are the biggets problem

    I joined a new project recently. I checked prod and our biggest bottleneck is unindexed foreign keys. It is high enough that I can see that it is causing problems. So I ran a query and got a list of all the unindexed foreign keys. Unfortunately there are about 80 of them. This application was inherited. The last team lost the project and I think one of the issues is with an off the shelf application (which we can't get rid of).
    I really don't like the idea of adding 80 indexes in a big rollout. It is too big of a change to do at once. It is also hard to measure whether those indexes may cause other problems. So what I would like to do is take my Enqueue waits for unindexed foreign keys and somehow figure out which unindexed foreign keys are causing us the biggest problem. With this many there is a strong possibility that some of these tables are having their parents hit more than others and some of these tables are blocking other sessions more than others.
    any suggestions on how to do this? It doesn't need to be exact. However, Id like to propose adding indexes that will give us the biggest bang for the buck.
    I am not sure how to take my system wide enqueue/deque waits down to particular tables being hit with DML that cause locking on child tables that in turn cause other sessions to be blocked.

    Guess2 wrote:
    I am not sure how to take my system wide enqueue/deque waits down to particular tables being hit with DML that cause locking on child tables that in turn cause other sessions to be blocked.Depending on your version of Oracle, and whether or not you are licensed to run the performance pack and diagnostic pack, you could query v$active_session_history (and it's repository dba_hist_active_sess_history).
    The type of query you need would be something like:
    select
            blocking_session, current_obj#, substr(to_char(p1,'xxxxxxxx'),-1), count(*)
    from
            v$active_session_history
    where
            event like 'enq: TM - contention'
    and     session_state = 'WAITING'
    and     sample_time between sysdate - 1/24 and sysdate
    group by
            blocking_session, current_obj#, substr(to_char(p1,'xxxxxxxx'),-1)
    /The counts would give you relative time for blocking due to each "current_obj#" - which you'd have to look up against object_id.
    I've also broken this down by blocking_session_id, and the lock mode (which ought to be 4 or 5) - 4 would SUGGEST simple parent/child collisions, 5 would SUGGEST that the probem could be exacerbated by "on delete cascade" constraints.
    Regards
    Jonathan Lewis

  • Foreign Key Relationships to external associations - Is it really this dodgy or is there a better way?

    Hi All,
    Let's picture that I have a GW service called Search Helps and within that service I have a PersonalAreas Entity Set which acts as a search help for drop down fields effectively that need to select a Personal Area.  I have 3 properties, with Personal Area Id and Company Code being the keys, and the text for Personal Area being the 3rd and last property. You really need to filter PersonalAreas by Company Code otherwise it's a fairly useless result set.
    Now within a different GW service, I have an entity called Position which has a single key of PositionId.  There is also a a property of company code on this Position.
    Now rather than asking the UI developer to get the Company code value and filter PersonalAreas with it directly, I thought it would be nicer for the UI developer just to use the navigation from a specific Position to PossiblePersonalAreas.  e.g. Positions('123')/PossiblePersonalAreas returns the entity set of PersonalAreas filtered by the Position's Company Code.
    So with that in mind, I add the external model reference pointing at the search helps service; then create an external association via the sneaky External Associations Editor button (that doesn't appear on the Wizard just to confuse you), and set up my Dependent entity to point at the Search Helps PersonalAreas entity.
    At this point I really want to tie the Position's Company Code to the PersonalAreas Company Code, but all I can do is set up a referential constraint of PositionId to CompanyCode or have no referential constraint at all (note - in my example I added the referential constraint as there is an issue with navigation keys being provided to external associations from what I can tell - more about this below).
    So, without any other option, I go into my GetEntitySet method of PersonalAreas and write something like the following:
      CASE iv_source_name.
        WHEN 'Position'.
          READ TABLE it_filter_select_options ASSIGNING <filter> INDEX 1.
          CHECK sy-subrc = 0.
          READ TABLE <filter>-select_options assigning <select_option> INDEX 1.
          CHECK sy-subrc = 0.
          position_id = <select_option>-low.
    *     Get company code for position
          TRY.
              CREATE OBJECT o_position
                EXPORTING
                  i_position_id = position_id.
              o_position->get_cost_centre_information(
                IMPORTING
                  e_company_code = company_code
            CATCH zcx_hr_object.
          ENDTRY.
      endcase.
    * Continue with retrieving PersonalAreas for given Company Code
    <Remaining code not shown>
    e.g. I have to assume CompanyCode is actually "Position Id" when the source of this call is from Position (I could also look at the navigation to find this has come from Position but if you're wondering, unfortunately for external associations, the key is not included in this for some reason but the same followup logic of reloading the object would be required).
    So the question I'm hoping the answer to is Yes is: Am I missing something in my understanding here?
    Thanks,
    Matt
    Edit since posting and playing around a bit more: Thinking about this further - it's unfortunate, but the navigation property in odata really implies the dependent entity has knowledge of the principal entity and realistically must know how to instantiate it if it needs to get data based on one of the properties. 
    Now while I'm fine with that (sort of) I think it's wrong that the dependent entity needs to have the required key properties to hold the principal entities as it makes something like a generic search help impossible to do with navigation - Maybe I just need to be done with that and expect filters to be used by UI programmers to find foreign key'ed entities....

    Hi Matt,
    I'm not surprised that you have an issue with this. One bugbear I have with Gateway is that for some reason the designers don't think any context beyond the immediate preceding navigation node is important. They don't support this within the same service,so it's hardly likley to work in a service reference.
    I may be wrong but I don't think GW is OData compliant in this respect. If I have the navigation path /blindservice/FromHereSet(1)/ToAPoints(22)/ToBPoints, it's rather restrictive to say I cannot see the initial key of '1' in the path when I am trying to resolve 'ToBPoints'. If that value - where I started - is key to the context, I have to know it.
    Currently the only way to access this context is to embed the 'key history' in the intermediate entities, i.e. /blindservice/FromHereSet(1)/ToAPoints(1,22)/ToBPoints. In my view that is corrupting the URl to suit the limitations of the SAP OData implementation. What's even more confusing/frustrating is that the technical request context appears to be able to store the stacked navigation keys but doesn't make use of this design. 
    I feel your pain
    Ron.

  • Catch foreign key violations in the model, not the database

    I must do something wrong, when I want to delete a master that still has details, the application will let me, but the database returns an FK violation error when the commit button is pushed. The association is in the model, there is no viewlink though.
    Why doesn't the framework check this before the database does? And how could I make the message more userfriendly? My users have no idea what it means if BLABLA_FK is violated
    Thanks in advance

    I might have the source of this problem. I have a table that has 2 foreign keys to the same other table. In my RowImpl I get duplicate case labels when I create both viewlinks because the final int gets the name of the referring table.
    Doesn't ADF support 2 foreign keys to the same table?
    Update: a testcase showed me that I chose the same name for the accessors of 2 different viewlinks, so that was not the problem.
    Message was edited by:
    Wendy Tromp

  • BC4J: getting info on foreign keys

    Hi,
    Why are getForeignKeyAttrs() and getEntityAssociations() from oracle.jbo.server.EntityDefImpl
    not public ?
    Is there any other way I can (should?) get information on foreign keys from Entities ?
    null

    Hi Laura,
    I appreciate your suggestion, but I think there is a fundamental problem with BC4J in this area:
    To get the Associations I would call getAssociationDefImpls() or getEntityAssociations() from oracle.jbo.server.EntityDefImpl right ?
    But they are not public (not accessible outside the package oracle.jbo.server)
    Also the class AssociationDefImpl and AssociationEnd are not public.
    How can I get to this kind of information from my own Entity or View classes ?
    I would really like to get to this information from my own DataWebBeans, so they can use usecombobox() on foreign keys instead of having to write this in the jsp page. (Which is far less generic)
    null

  • Foreign key Mapping based on Data - in SQL Developer Data modeler

    Team
    Do SQL Developer Data modeler supports Foreign Key mapping based on the Data in the Schema rather defined at the DDL ? For e.g if we implement a Objects Relation ship mapping in Data base, we don't define Foreign keys at table creation.
    Toad does this feature through "AUTOMATIC FOREIGN KEYS MAPPING IN TOAD DATA MODELER" more info at (http://toadworld.com/Blogs/tabid/67/EntryId/905/Automatic-Foreign-Keys-Mapping-in-Toad-Data-Modeler.aspx)
    any one know how to implement through some scripts also helps me
    Regards
    Raj

    If you have table PKs defined and the candidate columns match those PK columns, then you can use the Discover Foreign Keys utility. Right mouse over the relational model name (node) in the left browser. It is about half way down the menu. I did a blog post about it last week on kentgraziano.com.

  • SQL Developer Data Modeler - Relation to Foreign Key Generation

    SQL Developer Data Modeler 2.0.0 Build 584.
    I am having trouble with Relations to Foreign Keys when Forward Engineering a Relational Model from a Logical Model.
    First of all, the Naming Standard is not applied to the Foreign Keys when I perform the Engineer to Relational Model.
    So I right click on the Relational Model from the Browser and Apply Naming Standards to Keys and Constraints.
    I uncheck everything but Foreign Keys.
    Now, Foreign Keys are named according to my Naming Standards.
    However, this process also performs renames on the Column Foreign Keys even though I specifically unchecked that option.
    This appears to be a BUG in the software and I haven't found a way around it.
    I tried using {column} instead of {ref column} in the Naming Standard Template for Column Foreign Key, but that simply resulted in renaming my columns to "{column}".
    Please confirm and/or let me know of any work-around for this.
    Thanks,
    Dan

    Hi Philip,
    Thanks for the reply.
    Is this recorded as a bug to be addressed in the future?
    Should I submit this problem via Oracle Support?
    The other work-around I came up with is to override every Relation name in the Logical Model with the name I want to use in the Relational Model.
    When the Relational Model is Engineered, this becomes my Foreign Key name.
    Of course, this is not how I want to do things, so I am hoping for a bug fix someday.
    Regards,
    Dan

  • SQL data modeller -- how to create 1 to 1 relationship foreign key ?

    hi guys...
    i got 2 tables..
    table 1 - CFR
    CFR_ID = primary key
    table 2 - USER_PLAN
    USER_ID = primary key
    PLAN_ID,
    CFR_ID = foreign key reference (table 1)
    The business flows go like this..
    insdie CFR table, it contain all records / transactions of a particular user/plan. everytime a new transaction occurs for a plan/user, a new CFR_ID / row will be generated.
    after which, the newly generated CFR_ID for the new row , will be updated to the CFR_ID in USER_PLAN
    Thus, there is always a 1 to 1 relationship between the 2 table regardless how many CFR_ID is generated for a particular USER_PLAN. as the CFR_ID in the USEr_plan table will always be the latest one generated inside the CFR table.
    However, in the data modeller, i am unable to create such foreign key relationship... ANY idea how do i create a 1 on 1 foreign key relationship ? or there is no such way..
    Thanks and Best Regards,
    Noob

    Hi philips,
    Thanks for the wonderful reply..
    Just to double comfirm with you,
    even if i had set a unique constraint on CFR_ID(foreign key column), inside the relationship model, the relationship between the foreign key is still showing as a 1:m relationship right ?
    just that a character 'U' will appear beside the CFR_ID column.
    However the diagraphm is still showing a 1:M relationship.
    is this correct ?
    Regards,
    Noob

  • EServer Model Diagram and Cross Reference schema -Foreign key

    Hi,
    I am doing reverser engineering to generate ER diagram from Designer. Version of designer I am using is 10.2.0.2.
    While trying to generate SMD (Server model Diagram) from existing database schema, it is failing on generating foreign keys reference to other schema and its table.
    Can anybody help me to solve the this problem ?
    Viral Dave

    Note 236266.1
    CDS-11305 When Capturing a Foreign Key to a Table in Another Schema.
    * symptom: CDS-11306 Warning: Foreign Key <name> not processed because dependent Primary Key <name> not chosen for generation or does not exist in target database
    * symptom: Foreign Key to a Table in Another Schema is not Capture Designed
    * cause: This functionality is NOT supported by Oracle Designer. See: Bug 885654 FOREIGN KEYS TO DIFFERENT SCHEMA THAN BASE TABLE NOT SUPPORTED
    fix:
    In release 4.4 (6.5.89) and beyond, this functionality is still not
    supported, but the following message is issued for clarification:
    CDS-15302 Warning: <schema> clause of the relation referenced by foreign
    key constraint ... is unsupported
    Sorry....Designer will not capture that.
    Michael

Maybe you are looking for