Composite key

Hi All,
Can I create a composite key for new logical dimension in BMM layer ? for example combining three id countryid+StateID+EmployeeID for new logical dimension whose source will be county, state and employee table in physical layer. I also need to create a factless logical fact table where this composite/surrogate key should be placed in order to create a star schema.
Thanks,
Virat

You could create the composite key and do it the way you mentioned. Have a look at this post here: http://www.rittmanmead.com/2012/10/obiee-transactional3/ . Its aimed at modeling similar scenarios.

Similar Messages

  • Composite Key in Toplink Mapping File - equivalent to Hibernate?

    Hi,
    I have a POJO TestEntity which refers to primary key TestEntityKey. In Hibernate mapping hbm file, we define the entry as:
              <composite-id name="id" class="TestEntityKey">
                   <key-property name ="testEntityCode" column = "TEST_ENT_CODE" type = "string" />
              </composite-id>
    Please confirm how to create the composite id in Toplink means kindly help that how to map my id to key:
    <opm:primary-key>
         <opm:attribute-name>id</opm:attribute-name>
    <opm:field table="TEST_ENTITY_B" name="TEST_ENT_CODE" xsi:type="opm:column"/>
    </opm:primary-key>
    Thanks!

    Hey.. Thanks!
    I am clear about the concept about defining annotation based composite key. Also, I read in the documentation that I'll be needing to define as direct, aggregate or one-to-one. But, I am not able to define and run the same in the project mapping xml of toplink.
    It would be great if you can share some sample code for defining the same. For e.g. in my mentioned example, there is TestEntity POJO having 'id' as the attribute which gets populated with the testEntityCode of the TestEntityKey POJO. Please suggest the same for the same:
    <opm:primary-key>
    <opm:attribute-name>id</opm:attribute-name>
    <opm:field table="TEST_ENTITY_B" name="TEST_ENT_CODE" xsi:type="opm:column"/>
    </opm:primary-key>
    Thanks!

  • Composite key field is not a simple type or enum

    According to the docs here - http://www.oracle.com/technology/documentation/berkeley-db/je/java/index.html?com/sleepycat/persist/model/PrimaryKey.html - you can use "A composite key class containing one or more simple type or enum fields" as a key field. When we try that we get "java.lang.IllegalArgumentException: Composite key field is not a simple type or enum: Result$Key.recordId". Am I misreading the docs?
    Thanks,
    Trevor
    @Persistent
    public final class RecordKey {
    @KeyField(1)
    private final String name;
    @KeyField(2)
    private final int duplicateNumber;
    RecordKey(final String name, final int duplicateNumber) {
    this.name = name;
    this.duplicateNumber = duplicateNumber;
    RecordKey() {
    this.name = null;
    this.duplicateNumber = -1;
    @Persistent
    static final class Key {
    @KeyField(1)
    private final RecordKey recordId;
    @KeyField(2)
    private final String key;
    Key(final RecordKey recordId, final String key) {
    this.recordId = recordId;
    this.key = key;
    Key() {
    this.recordId = null;
    this.key = null;
    }

    Hi Trevor,
    You're nesting one key class inside another. All fields of a key class must be simple types or enums, which is what the exception message is trying to say. If you want all those fields in your key class, you'll have to include them in a single flattened class.
    Neither nesting of key classes nor inheritance of key classes is supported. We have enhancements filed to support these in the future, but no concrete plans.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Setting composite key in Container Managed Entity Bean

    In my database table i set primary key to two columns making them as composite key. how do i set that in my container managed entity bean home interface findByPrimaryKey() method and in deployment descriptor file.

    1. create another class (say CompositePK) that will embed the two fields keyA and keyB corresponding to the two pk of your table (declare them public) .
    2. in your Bean declare keyA and keyB public.
    3. in the dd declare your bean primary-key-class as CompositePK and the primary-key-field as keyA and keyB.
    this is the method i use (with BAS) even if the key is simple (such as Integer).

  • Trouble with a composite key & unique violation

    Hi all
    as mentioned yesterday I'm a novice so apologies in advance for any lack of clarity in my question:
    I'm doing the standard student estate agent database and I have come across an issue with a composite key.
    the table in question follows:
    CREATE TABLE Offer
    buyer_id CHAR(5) not null references buyer (buyer_id),
    property_id CHAR(5) not null references property (property_id),
    primary key (BUYER_ID, PROPERTY_ID),
    offer_date DATE not null,
    offer_time NUMBER(4) not null,
    offer_amount NUMBER(10,2) not null
    and I have all the other tables in position with data loaded. However, when I try to load data into this table the buyer_id & property_id can be duplicated (it makes sense a buyer could make several offers on the same property).
    I'm not sure how to get around it. When I simply remove the primary key line the the next line offer_date.... is not recognized. I'm I missing something obvious? I am not allowed to changed the structure of the table. Do I need another identifier for the composite key?
    thanks Jo

    If you want to stick with natural primary keys, you would probably need to use the combination of (buyer_id, property_id, offer_date), assuming that the same buyer wouldn't make simultaneous offers on the same property. Given that this creates a rather unwieldy key for any child tables to reference, and given that the BUYER and PROPERTY tables appear to have synthetic foreign keys, you would probably want to add an OFFER_ID column to your table that is the primary key for the table and is populated via a sequence.
    Justin

  • Master-Detail query problem with composite key

    I have tested a MD form with EMP and DEPT tables and the MD query works okay.
    I have created two tables both with two fields EMP_ID and REPORT_DATE as a composite key. The problem I am having with the MD form is that it does not query back the results when I select the QUERY button. I have verified that the join is setup during the creation of the form.

    I have recreated the form and the MD query works fine.

  • (EJB-3) Can a many-to-one/one-to-may join field be part of a composite key?

    I've been setting up my first set of EJB-3 entites and I'm hitting an error I can't see the reason for. I don't have the code with me here- I'll add it to the thread tomorrow if there isn't a simple answer in the meantime.
    Two entity classes, Invoice and VatTotal. Invoice has a synthetic key, VatTotal is keyed on invoive id and vat code. VatTotals are children of the Invoice.
    So I code a Key class for the VatTotal entity, with Invoice and VatCode fields (VatCode is just a String). I define a ManyToOne property called invoice in VatCode and mark it @Id and a OneToMany field in Invoice called totals with type List<VatCode>
    Netbeans seems to accept it, but when I try and create the EntityManagerFactory (using Hibernate) it rejects the mappedBy=invoice on the OneToMany in Invoice.
    Does Hibernate accept ManyToOne properties as part of a composite key? Is there a problem using such a property in a OneToMany? Maybe I've done something dumb, but I can't see it.

    I don't think so. And I've seen some anomolies in the print preview (parts of messages getting cut off or munged up).

  • DATE Field in composite key

    Hi experts.
    I have a small query.
    Is there any performance impact of having a date field along with four other fields as part of a composite key.

    When you add an index, there is definitely some overhead to get the index synchronized with newly added/updated data (so whether you have indexed NUMBER, CHARs or DATEs does not matter - but I could be wrong in saying this).
    Concerning your SELECTs, if your existing queries were using this index then they may or may not use the new index (due to cardinality and other factors); so you need to test this first.

  • Primary Key in DW and indexes - composite key of all dimensional FKs?

    Hi guys,
    I have a DW and indexing question. Our metadata DW and physical DW are the same (star schema, no snowflakes). Should all dimensional FKs (such as TIME_KEY, ORG_KEY) be included as a part of a fact table's PK (a composite key becomes a combination of the TIME_KEY, ORG_KEY, etc.) in the database. Second question is, should we create just 1 composite index per fact table (resembling fact table's PK) or should we build several indexes (1 per dimension) ? Also, does it pay to build indexes on dimension tables?
    I'm mostly worried about fact table with a few hundred million records that has 7 dimensional-FK columns(only numeric codes), 1 value column, and several ETL-related date columns. I wonder what's the best course scenario be for that one.
    Thank you.

    You can use bitmap indexes on foreign keys to enable star transformations to be carried out. There are full details in the Datawarehouse documentation. Unfortunately I can't access it at the moment to show you where!
    As with anything you can check your performance using oracle trace events (10046) to ensure its performing as you want.
    http://www.dwoptimize.com/2007/06/101010-answer-to-life-universe-and.html
    Edited by: Matt T on Oct 22, 2008 4:50 PM

  • Composite key in Time dimension

    Hi All,
    I would like to know Time dimension with Composite key. I have a requirement where I want to store 2 Calendars in Time dimension table. for e.g :
    for one calendar Weekstarts from SUN-SAT and for another it is from MON-TUE
    DateKey   Type WeekStart   WeekEnd
    20140101   1       Sun               Sat      
    20140101   2       Mon               Tue
    ..................etc
    I have a measure group which is related to Time dimension (DateKey and Type used a Composite key). This implementation has no issues for additive measures but there are few issues with semi-additive measures (last non-empty,...).
    Will composite Key have any effect on semi-additive measures ?
    what if i use surrogate key instead of composite key.
    Please suggest if the approach has any issue with Time intelligence. Advise if there is any better approach for the same.
    Ram MSBI Developer

    Hey.. Thanks!
    I am clear about the concept about defining annotation based composite key. Also, I read in the documentation that I'll be needing to define as direct, aggregate or one-to-one. But, I am not able to define and run the same in the project mapping xml of toplink.
    It would be great if you can share some sample code for defining the same. For e.g. in my mentioned example, there is TestEntity POJO having 'id' as the attribute which gets populated with the testEntityCode of the TestEntityKey POJO. Please suggest the same for the same:
    <opm:primary-key>
    <opm:attribute-name>id</opm:attribute-name>
    <opm:field table="TEST_ENTITY_B" name="TEST_ENT_CODE" xsi:type="opm:column"/>
    </opm:primary-key>
    Thanks!

  • Composite key constraint in SSIS

    Hi All,
    I have created one SSIS package to move data from one table to another table in same database using oledb connection.Now I want to enforce composite key constraint while moving data as follows:
    Table A has following contents :                                                 
    Col1   col2  col3
    1         a        b
    2         c        d
    3         a        b
    So,while moving data, i want to verify the contents of col2 and col3(col2+col3) ie,composite key made of col2 and col3.In this case i want to move data of row 2 only and data of row 1 and 3 will go to error log file.
    I am trying to use lookup here but no luck yet. Can anybody help me to achieve this .
    Thanks in advance,
    Sanket 

    Hi Sanket, 
    I do agree with Visakh approach if table reside on same server, why go for the SSIS. But If you still want to do it, here are steps(It bit complex for simple operation like this, i didn't find
    any other approach).  I am using same table structure as mentioned above: 
    create table sampletest
     col1 int ,
     col2 varchar(10),
     col3 varchar(10)
    GO
    insert into sampletest
    values (1,'a','b'),(2,'c','d'),(3,'a','b')
    1.)   Load the
    Data from source with all columns.
    2.)   Place an Aggregate
    Task .Here is configuration:
    Column
    Operation
    Col1
    Max/Min
    Col2
    Group by
    Col3
    Group by
     (*)  - Output Alias (say cnt)
    Count All
    Figure 1: 
    3.)  Place a condition split. With expression
    (DT_I4)Cnt == 1
    2.)   
    Move case1 to destination table and other conditional split to error table.
    Full Diagram:
    Regards Harsh

  • Is it possible to create foreign key from composite key in other table.

    SQL> desc PRODUCT_CONFIG_OPTION;
    Name Null? Type
    CONFIG_ITEM_ID NOT NULL VARCHAR2(20) --composite primary key
    CONFIG_OPTION_ID NOT NULL VARCHAR2(20) --composite primary key
    CONFIG_OPTION_NAME VARCHAR2(100)
    DESCRIPTION VARCHAR2(255)
    SEQUENCE_NUM NUMBER(18)
    LAST_UPDATED_STAMP TIMESTAMP(6)
    LAST_UPDATED_TX_STAMP TIMESTAMP(6)
    CREATED_STAMP TIMESTAMP(6)
    CREATED_TX_STAMP TIMESTAMP(6)
    SQL> DESC PRODUCT_CONFIG_ITEM;
    Name Null? Type
    CONFIG_ITEM_ID NOT NULL VARCHAR2(20)
    CONFIG_ITEM_TYPE_ID VARCHAR2(20)
    CONFIG_ITEM_NAME VARCHAR2(100)
    DESCRIPTION VARCHAR2(255)
    LONG_DESCRIPTION CLOB
    IMAGE_URL VARCHAR2(255)
    LAST_UPDATED_STAMP TIMESTAMP(6)
    LAST_UPDATED_TX_STAMP TIMESTAMP(6)
    CREATED_STAMP TIMESTAMP(6)
    CREATED_TX_STAMP TIMESTAMP(6)
    SQL> desc product;
    Name Null? Type
    PRODUCT_ID NOT NULL VARCHAR2(20)
    PRODUCT_TYPE_ID VARCHAR2(20)
    PRIMARY_PRODUCT_CATEGORY_ID VARCHAR2(20)
    MANUFACTURER_PARTY_ID VARCHAR2(20)
    FACILITY_ID VARCHAR2(20)
    INTRODUCTION_DATE TIMESTAMP(6)
    SUPPORT_DISCONTINUATION_DATE TIMESTAMP(6)
    SALES_DISCONTINUATION_DATE TIMESTAMP(6)
    SALES_DISC_WHEN_NOT_AVAIL CHAR(1)
    INTERNAL_NAME VARCHAR2(255)
    BRAND_NAME VARCHAR2(100)
    COMMENTS VARCHAR2(255)
    =========
    CREATE TABLE PROD_CONFIG_PROD_CONFIG_OPTION (
    PRODUCT_ID VARCHAR2(20),
    CONFIG_ITEM_ID VARCHAR2(20),
    CONFIG_OPTION_ID VARCHAR2(20),
    PAGE_NUM_TO NUMBER(18),
    ALTERNATE_PAGE_NUM_TO1 NUMBER(18),
    ALTERNATE_PAGE_NUM_TO2 NUMBER(18),
    ALTERNATE_PAGE_NUM_TO3 NUMBER(18),
    LAST_UPDATED_STAMP TIMESTAMP(6),
    LAST_UPDATED_TX_STAMP TIMESTAMP(6),
    CREATED_STAMP TIMESTAMP(6),
    CREATED_TX_STAMP TIMESTAMP(6),
    CONSTRAINT PK_PROD_CAT_CONFIG_MOD PRIMARY KEY (PRODUCT_ID),
    CONSTRAINT FK_PRODUCT_ID FOREIGN KEY (PRODUCT_ID) REFERENCES PRODUCT(PRODUCT_ID),
    CONSTRAINT FK_CONFIG_ITEM_ID FOREIGN KEY (CONFIG_ITEM_ID) REFERENCES PRODUCT_CONFIG_ITEM(CONFIG_ITEM_ID),
    CONSTRAINT FK_CONFIG_OPTION_ID FOREIGN KEY (CONFIG_OPTION_ID) REFERENCES PRODUCT_CONFIG_OPTION(CONFIG_OPTION_ID) )
    TABLESPACE DATA_SMALL
    i try to create this table if i omit 3rd foreign key constraint then table successfully created.but including trd foreign key constraint it return error "ORA-02270: no matching unique or primary key for this column-list"
    i checked everything is it possible to create foreign key from composite key in other table.

    And
    CONSTRAINT FK_CONFIG_OPTION_ID FOREIGN KEY (CONFIG_ITEM_ID,CONFIG_OPTION_ID) REFERENCES PRODUCT_CONFIG_OPTION(CONFIG_ITEM_ID,CONFIG_OPTION_ID)
    ?

  • Delete Reconciliation fails when a Composite Key is used

    Hi Guys ,
    Problem Statement :-
    I am facing problem in performing delete reconciliation when a composite key is used.It fails whenever we have more than one attribute as key
    in reconciliation field mappings.
    I am using prepareDeleteReconData() ..etc Api's to perform delete reconciliation. I am not using CreateDeleteReconciliationEvent() as i dont know which users are deleted.
    UseCase
    For eg . Consider Oracle DataBase UM connector , where you have composite key defined as (UserID and ITResource), it fails to generate a delete reconciliation event.
    Have anybody faced this ?? Any workarounds ?
    Thanks
    Surendra Singh

    Hey Surendra,
    This is what you can do to get rid of this problem. I kow you cannot use the 'createDeleetReconciliationEvent' API, but just to let you know that this works absolutely fine. Now The approach which you might be using has the following flow-
    - provideDeletionDetectionData()
    - getMissingAccounts()
    - deleteDetectedAccounts()
    Now you must be aware that getMissingAccounts() returns a ResultSet for all the instances which needs to be revoked in OIM. If you see the contents of this ResultSet, here is what it contains (4 columns):
    Objects.Key, Objects.Name, Structure Utility.Table Name, Process Instance.Key
    Now what I suggest is do not use the deleteDetectedAccounts API as of now. And Revoke the object instance using API call. Follow the following steps:
    1) Just iterate through the ResultSet *(deletedUsers)* obtained from 'getMissingAccounts()' to fetch the value 'Process Instance.Key' and store it in an Array.
    2) You must be passing the Object Name as a Task Attribute. Use this attribute to fetch the 'Object Key'. Once you get this value, use the 'getAssociatedUsers' API of objectOperationsIntf to find all the users associated with this object. This API will return a ResultSet. Let's name it as *'AssoUsers'*.
    3) Iterate the above ResultSet(AssoUsers) and fetch the *'Process Instance.Key'* column from its rows. Compare this value to the already created Array in step-1. If there is a match then you will know that this resource instance needs to be revoked.
    4) Now fetch the following two values from the ResultSet(AssoUsers):
    - Users.Key
    - Object Instance.Key
    5) Once you get the User Key, you will have to find its corresponding resources. Do it by using *'getObjects'* API of userOperationsIntf. This will again return a resultSet *(userObjects)*.
    6) Iterate through all the rows and check the value of column *'Objects.Name'*. If this value equals to your resource, then fetch the value of column- Users-Object Instance For User.Key from this row.
    7) This will give you the 'Object instnace for User key'.
    8) Call the revokeObject API of userOperationsIntf interface.
    Below is a sample code snippet for your reference.
              Array DeletedUsers = {Your Deleted User List Array};
              String ObjectName = "Your Object Name as it comes from Task Attribute";
              long ObjectKey = 1; // Fetch it from Object Name above using API
              HashMap dummy = new HashMap();
              tcResultSet AssoUsers = objectOperationsIntf.getAssociatedUsers(ObjectKey, dummy);
              for (int i=0 ; i<AssoUsers.getRowCount() ; i++) {
                   AssoUsers.goToRow(i);               
                   String piKey = AssoUsers.getStringValue("Process Instance.Key");
                   if("Your Array DeletedUsers contains piKey"){
                        long userKey = AssoUsers.getLongValue("Users.Key");
                        long obiKey = AssoUsers.getLongValue("Object Instance.Key");
                        logger.debug("userKey extracted is : " + userKey);
                        logger.debug("obiKey extracted is : " + obiKey);                    
                        tcResultSet userObjects = userOperationsIntf.getObjects(userKey);
                        for(int j=0 ; j<userObjects.getRowCount() ; j++) {
                             userObjects.goToRow(j);
                             if(ObjectName.equalsIgnoreCase(userObjects.getStringValue("Objects.Name"))) {                              
                                  long obiuKey = userObjects.getLongValue("Users-Object Instance For User.Key");
                                  userOperationsIntf.revokeObject(userKey, obiuKey);
                                  logger.debug("Resource has been revoked");
    This should work. I know this looks quiet complex but have to do it. Give it a try.
    Thanks
    Sunny

  • Composite key join

    table pp
         col name
         a
         b
         c
         d
         e
         f
         table qq
         col name
         g-composite key
         h-composite key
         relation ship
         table qq( g,h)->table pp(a,b)
         table qq( g,h)->table pp(e,f)
         table pp and table qq have parent child relation ship.
         i want to join two table
         please let me kow where clause of my query is right or not
    from pp
    where
         (pp.a,
         pp.b,
         pp.e,
         pp.f
    ) IN (
    SELECT qq.g,qq.h,qq.g,qq.h
    FROM qq)
    qq
    g,h
    100,101
    pp
    a,b,c,d,e,f
    100,101,aa,bb,100,101
    100,101,cc,dd,100,101
    Message was edited by:
    anutosh

    from pp
    where
    (pp.a,
    pp.b,
    pp.e,
    pp.f
    ) IN (
    SELECT qq.g,qq.h,qq.g,qq.h
    FROM qq)
    That is not a "join".
    A join would be
    from pp, qq
    where
    pp.a = qq.g
    and pp.b = qq.h
    and pp.e = qq.g
    and pp.f = gg.h

  • Composite Key Validation in EOImpl

    Hello,
    Please anyone can give example of how to validate composite key validation?
    I have tried by following in EOImpl code but its not working:
    OADBTransaction transaction = getOADBTransaction();
    Object[] ItemKey = {getOrganizationId(),getUserId(),getProcess()};
    EntityDefImpl def = XxEOImpl.getDefinitionObject();
    XxEOImpl item_name = (XxEOImpl)def.findByPrimaryKey(getOADBTransaction(),new Key(ItemKey));
    if (item_name != null)
    throw new OAException("Erorr duplicate");
    Please suggest its urgent..
    Thanks,
    Swati Thakkar

    Hello Gurus,
    Can you please suggest the following way of validation is correct or not!?
    We have defined primary key on 3 attributes as a composite key, created EO and VO.
    Now to add new row we are asking values from user using LOV values.
    is the handling of unique value constraint using TooManyObjects Exception valid approach to handle error?
    EOImpl Code:
    try {
    setAttributeInternal(PROCESSTYPE, value);
    } catch (TooManyObjectsException toomany) {
    throw new OAException("Value is already exist.");
    Please suggest the right approach to handling Composite key validation..
    Thanks,
    Swati

Maybe you are looking for

  • Opening JPG directly in Photoshop, passing Camera Raw

    Hi! I would like to open JPGs that were edited in Camera Raw directly in Photoshop and I saw in this video from Russel Brown how I could do this. Only, he is using Bridge CS3 in the video and I am using CS4. The thing is that I don't have "Always ope

  • How do I embed an image in an email?

    I have an infopath form in Sharepoint that submits to email. One of the fields is a picture box that allows users to upload a photo. They are able to upload the photo but when it is submitted, it does not show in email. I have also tried adding a ric

  • Looking for BPM Enterprise Edition architecture Diagram

    I am looking for a BPM Enterprise Edition architecture Diagram showing how all the pieces (e.g. BPM, Oracle DB, LDAP directory, WebLogic server, Application server etc.) fit together . If it is available on the internet, can you please let me know th

  • How to reduce page faults (virtual memory) usage in LabVIEW

    I am running LabVIEW 2010 on Windows Embedded Standard system 4G (3G usable) of RAM. The program (executable running on the Run-Time Engine) continuously samples from a USB-6251 at 1MS/sec (2 channels @ 500K) and scans the data stream for anomalous e

  • ModalForm close action

    In the modalform when I'm pressing the add button it does this: call the on-demand process do some verifications and: if give some error it shows error and don't close form if it's all ok send and close form My problem is that it's not closing if it'