One to one relationship modelling

Hi all
How to model a one to one relationship?
i have a scenario where i had to maintain 2 different entities and cannot merge them into a single table coz they are separate entities
Now while modelling them ... do we need to have a primary key for the second table (or)
use the primary key of the first table as the foreign key on the second table with Unique constraint on it .
Ex: a single subscription has a single criteria
subscription table ........... and criteria table
now should i iuse criteria id as a primary key of criteria table ? (or)
subscription id as the foregin key in the criteria table ?
or allow include both in the criteria table
please suggest
Thanks and Regards
Raj

hi dportas,
first of all thanks for your respose...
what is reciprocal foreign key?
my scenario is like this
i have a table called subscriptions which records all subscriptions that we have subscribed to to receive an alert to our email primary key is subscriptionid.
every alert has an alert criteria with different set of attributes
hence i have 5 alert criteria tables... each with totlally different type of attributes
eg: balance criteria (balanceamount,condition) cutoff criteria(cutofftime,....)
we can subscribe to only one alert in a single subscription
hence subscription to balance criteria table is 1-1
subscription to cutoff criteria table is 1-1
now my question is that shoudl each of the criteria table should have criteriaid (or) should i put subscription id as the foregih key in each of the tables for relationship

Similar Messages

  • Mapping one-to-one relationship

    Hi mates, i have two tables
    // Car Table CREATE TABLE CAR ( CAR_ID NUMBER(19,0) DEFAULT 1 NOT NULL, LAST_UPDATE TIMESTAMP DEFAULT SYSDATE, MAKE VARCHAR2(20), MODEL NUMBER(5,0), REGISTRATION VARCHAR2(25), MILEAGE NUMBER, ENGINE_SIZE NUMBER(1,1), TANK_SIZE NUMBER(2,0), GAS_IN_TANK NUMBER(2,0), CATEGORY_ID NUMBER(19,0) DEFAULT 1 NOT NULL, PRIMARY KEY (CAR_ID) ); // Contract CREATE TABLE CONTRACT ( CONTRACT_ID NUMBER(19,0) DEFAULT 1 NOT NULL, LAST_UPDATE DATE DEFAULT SYSDATE, STATUS VARCHAR2(32), ORDER_NUMBER VARCHAR2(32), RENTAL_DATE DATE, CUSTOMER_ID NUMBER(19,0) DEFAULT 1 NOT NULL, PRIMARY KEY (CONTRACT_ID) );
    I need to establish a one-to-one relationship here (a contract has one car associated to it, car will only belong to one active contract ) .. If i add foreign key to Car and reference Contract
    ALTER TABLE CAR ADD FOREIGN KEY (CAR_ID) REFERENCES CONTRACT (CONTRACT_ID) ;
    Then use reverse engineering to create hibernate mappings (in eclipse), i get a one-to-many relationship (contract has many cars)? how do i enforce table to to be interpreted this way?

    sonx wrote:
    (a contract has one car associated to it, car will only belong to one active contract ) The relationship is from contract to car.
    .. If i add foreign key to Car and reference Contract
    ALTER TABLE CAR
         ADD FOREIGN KEY (CAR_ID)
         REFERENCES CONTRACT (CONTRACT_ID)
    ;This relationship is from car to contract.
    Which contradicts what you said above.
    And isn't logical. A car will over time belong to different contracts. Each contract retains the original car. The car can't contain all of them.

  • One to one relationship between records while entering in MDM data manager?

    Example Scenario::
         I have created <b>Employee details</b>(main table) and<b> Salary</b> (look up flat table for employee number filed in main table) .  Tried to get the corresponding employee's gross salary from <b>salary</b> table to <b>employee Details</b> table basing on <b>Employee number</b> field in Employee Details table as <b>Gross salary</b> and <b>Employee number</b> are common fields for both the tables. But i could not get one to one relationship in this case , Please explain how to achieve?

    Employee Details (Main Table)
                   EmpNo(Look up field)      EmpNa     GrossSal(Look up field)
    Salary Details  (Look Flat Table)
         Empno         Basic Sal        GrossSal   
          012              5000             10000
                     013              4000               8000
    I have created two tables with the above fields. In main table i kept two look up fields to Salary Details table. First i have entered data to salary table as above , now when i am trying to enter data in to main table EmpNo as 012 it should show Gross salary as 10000 automatically as per the corresponding EmpNo. Instead it is showing all the Grosssal values of Salary table.

  • If Company has one to one relationship with Company code

    Dear All,
    If Company has one to one relationship with company code in the transaction system (ECC),
    can we use company in place off company code - in the BCS system?
    That is, in this case - under consolidation units
    - company,
    i will be using the ECC companies rather than ECC company codes as consolidation units.
    Request your insights.
    Cheers
    Kumar

    Actually, I almost always use the company, not the company code. The difference is in the different number of attributes, and the type CHAR 4 or 6. 0COMPANY is the standard infoobject for using in SEM-BCS.
    Though, I also used the custom infoobject for ConsUnit. Not a problem. Everything works. Just one needs to be careful with infoobjects which are the references to the Company IO.

  • I have a HP 6510 All in One printer Model # CQ761A. It does not respond to touching the screen

    I have a HP 6510 All in One printer Model # CQ761A. Using Windows XP.
    Power light is on and wireless light is on. When I touch the touch screen there is no response from the printer. The computer and network does not see the printer and power button will not power down the printer. I have to unplug the power from the printer to get it to turn off then on and start working. Works fine for a day or two then back to malfunctioning.

    Try working through this support document. it walks through resetting the power module and testing it. It also includes a video which is very helpful.
    The HP Product Won't Turn On or Respond
    If this does not resolve your issue post back so we can get it fixed for you.
    -------------How do I give Kudos? | How do I mark a post as Solved? --------------------------------------------------------

  • ACE in one-arm model. VIP on Client Side, servers in other vlan

    Hello All
    i have a LAN whit many servers,but only 2 need to be balanced. So i think in one-arm model, due to the higth trafic that not be pass trought ACE.
    i have a vlan 900 where is the client side and the VIP also. (10.0.9.64/26)
    the servers are in vlan 503 (10.12.3.0/24)
    it mi first design with ONE-arm but i thinks something is missing, because doesn't work.
    the configuration is the next:
    MSFC:
    svclc module 1 vlan-group 1,2,
    svclc vlan-group 1 503,900-902
    svclc vlan-group 2 511
    interface Vlan503
    description OSS_&_Otros
    ip address 10.12.3.253 255.255.255.0
    standby 10 ip 10.12.3.254
    standby 10 priority 150
    standby 10 preempt delay minimum 305
    interface Vlan900
    description MSF_<->_ACE
    ip address 10.0.9.126 255.255.255.192
    end
    access-list 101 permit ip 10.12.3.0 0.0.0.255 10.0.9.64 0.0.0.63
    access-list 101 deny ip any any
    route-map From_Server_OSS_to_ACE permit 10
    match ip address 101
    set ip next-hop 10.0.9.125
    ACE_1/admin#
    ip route 0.0.0.0 0.0.0.0 10.0.9.126
    context OSS
    allocate-interface vlan 511
    allocate-interface vlan 900
    allocate-interface vlan 902
    member Max20
    ACE_1/OSS# sh run
    Generating configuration....
    access-list EVERYONE line 10 extended permit ip any any
    access-list EVERYONE line 20 extended permit icmp any any
    rserver host OSS_FES_1
    description OSS_Front_End_Server_1
    ip address 10.12.3.140
    inservice
    rserver host OSS_FES_2
    description OSS_Front_End_Server_2
    ip address 10.12.3.150
    inservice
    serverfarm host SERVER_farm_OSS
    rserver OSS_FES_1
    inservice
    rserver OSS_FES_2
    inservice
    class-map match-all VIP-OSS
    2 match virtual-address 10.0.9.66 any
    policy-map type loadbalance first-match OSS-LB-POLICY
    class class-default
    serverfarm SERVER_farm_OSS
    policy-map multi-match OSS-POLICY-MAP
    class VIP-OSS
    loadbalance vip inservice
    loadbalance policy OSS-LB-POLICY
    loadbalance vip icmp-reply
    interface vlan 900
    description Clients-side
    ip address 10.0.9.125 255.255.255.192
    access-group input EVERYONE
    access-group output EVERYONE
    service-policy input OSS-POLICY-MAP
    no shutdown
    ip route 0.0.0.0 0.0.0.0 10.0.9.126
    maybe a i need to allocate the vlan 503 in OSS Context, any advice?
    Thanks in advace,
    Gianni From Chile

    Since you server are not behind the ACE in either bridge or routed mode add the follwoing to your config and use nat to get the traffic back to the ace.
    This is how one-armed mode works.
    ACE_1/OSS# sh run
    Generating configuration....
    access-list EVERYONE line 10 extended permit ip any any
    access-list EVERYONE line 20 extended permit icmp any any
    rserver host OSS_FES_1
    description OSS_Front_End_Server_1
    ip address 10.12.3.140
    inservice
    rserver host OSS_FES_2
    description OSS_Front_End_Server_2
    ip address 10.12.3.150
    inservice
    serverfarm host SERVER_farm_OSS
    rserver OSS_FES_1
    inservice
    rserver OSS_FES_2
    inservice
    class-map match-all VIP-OSS
    2 match virtual-address 10.0.9.66 any
    policy-map type loadbalance first-match OSS-LB-POLICY
    class class-default
    serverfarm SERVER_farm_OSS
    policy-map multi-match OSS-POLICY-MAP
    class VIP-OSS
    loadbalance vip inservice
    loadbalance policy OSS-LB-POLICY
    loadbalance vip icmp-reply
    nat dynamic 10 vlan 900
    interface vlan 900
    description Clients-side
    ip address 10.0.9.125 255.255.255.192
    nat-pool 10 0.9.126 10 0.9.126 netmask 255.255.255.192 pat
    access-group input EVERYONE
    access-group output EVERYONE
    service-policy input OSS-POLICY-MAP
    no shutdown

  • Can Legal Entity - Operating Unit have One to One Relationship in R12

    Hi,
    I want to configure one Legal Entity to one Operating Unit in R12 as it was in 11i. ie One to One Relationship, How can I achieve this ?
    Thanks in Advance,
    Thejas

    That is because you're not setting it, obviously. Nowhere in your code are you actually populating the order property of the orderlines.

  • Building report from more than one data model

    Hi Experts,
    I have a requirement to build a report in BI Publisher.
    The report has three section each having their own data source.
    When i try to create report in BI Publisher it allows me to associate one data model per report.
    is it feasible to have more than one data source for a single report.
    Cheers,
    Andy

    Hi Andy,
    Not sure If this meets your requirement, please do have a look at the following links:
    http://www.rittmanmead.com/2008/04/24/bi-publisher-reports-with-multiple-data-sources/
    http://blogs.oracle.com/xmlpublisher/2008/07/multiple_datasources_i.html
    http://blogs.oracle.com/xmlpublisher/2008/07/multiple_datasources_ii.html
    Thanks.

  • Problem with cascade delete in CMP one-to-one relationship

    I am not able to cascade delete for one-to-one relationship. Even though relationship seems to be setup correctly, record from the second table is not deleted.
    Following is the structure of tables i am using:
    First Table(vcc_lrmc) -- LRMCBean
    lrmc_id pk (Bean field is id)
    lrmc_dtl_id (Bean field islrmcDtlId)
    Second Table (vcc_lrmc_dtl) -- LRMCDetailBean
    lrmc_dtl_id (pk) (Bean field islrmcDtlId)
    lrmc_id (Bean field id)
    One to one bidirectional relationship has been setup with CMR fields moreLRMC and mainLRMC.
    section of ejb-jar is as follows:
    <ejb-relation>
    <ejb-relation-name>LRMCMainToDetail</ejb-relation-name>
    <ejb-relationship-role>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>LRMC</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>moreLRMC</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <multiplicity>One</multiplicity>
    <cascade-delete/>
    <relationship-role-source>
    <ejb-name>LRMCDetail</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>mainLRMC</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    section of orion-ejb-jar is as follows:(Bidirectional mapping)
    <entity-deployment name="LRMC" data-source="jdbc/VCCDS" table="VCC_LRMC">
    <cmp-field-mapping name="moreLRMC">
    <entity-ref home="LRMCDetail">
    <cmp-field-mapping name="lrmcDtlId" persistence-name="LRMC_DTL_ID"/>
    </entity-ref>
    </cmp-field-mapping>
    </entity-deployment>
    <entity-deployment name="LRMCDetail" data-source="jdbc/VCCDS" table="VCC_LRMC_DTL">
    <cmp-field-mapping name="mainLRMC">
    <entity-ref home="LRMC">
    <cmp-field-mapping name="id" persistence-name="LRMC_ID"/>
    </entity-ref>
    </cmp-field-mapping>
    </entity-deployment>
    Is there anything else need to be setup for Cascade delete or is there anything wrong the way one-to-one relationship has been setup.
    Pls. advice.
    Thanks
    Dhiraj

    Is it happening because of this bug.
    Cannot create a 1:1 bi-directional CMR for entity beans when database tables are reverse engineered. (2447364)
    Anyone, any idea on this ?
    Cheers,
    Dhiraj

  • How to generate lookup if there is one-to-one relationship?

    Hi,
    I am an new Jheadstart user and i am using Oracle Developer 10g with Jheadstart.
    There are two tables in my database with a one-to-one relationship between them.
    My database concept is that I need to have one table as a lookup of the other one. Jheadstart does not generate it that way because the relationship is not one-to-many, so I am not geting nor choice, nor lov.
    Could this possibly be solved?

    You probably get better answers in the JHeadstart forum.

  • How to query objects on variable one-to-one relationship

    Hi,
    I have a situation here:
    Application (APPLICATION table) has many payoffs (Payoff table); Primary key of application is the foreign key of payoff.
    Payoff has disbursement, such as check(check table), directDeposit(directDeposit table) or Wire(wire table), which is variable one-to-one relationship. They share the same primary key
    The query I need to run is to search application based on check number, How do I construct a query to perform this kind of search?
    Thanks
    Hao
    [email protected]

    Hi Doug,
    Thanks for all your help. But I guess I still need more details from you to help me understand the solution.
    First of all, I want to make sure I make my case clear
    Application (application table, pk: uniqueAppId) has many payoffs (Payoff table, pk: payoffId);
    Payoff object has variable one-to-one mapping to Disbursement object, which is a abstract super clss for following objects:
    Check(payoff-check table, pk: payoffId)
    DirectDeposit(payoff-deposit table, pk: payoffId)
    Wire(payoff-wire table, pk: payoffId),
    The query I want to run is to get me back an application for a particular check number
    From you email, first I thought "check" is a object, then your sample code showed it is a string. So I am kind of confused. The document you pointed seems not reflect my case. I wonder it is because I didn't present my case clear the first time.
    Looking forward to your further help
    Hao

  • One to One relationship

    Oracle 11.0.1.7:
    Is it ok to have foreign key as primary key in one to one relationship? Is there any drawbacks? I have 2 options:
    1. Create sequence primary key
    2. Or make foreign key as primary key
    Which one is better and why? I like # 2 just because I don't have to create extra index, sequence and column.

    user628400 wrote:
    Oracle 11.0.1.7:
    Is it ok to have foreign key as primary key in one to one relationship? If the relationship is truely one-to-one, then you haven't properly normalized your data.
    "Every nonkey attribute must be functionally dependent upon
         the key, (1NF)
         the whole key, and (2NF)
         nothing but the key, (3NF)
         so help you Codd."
    Is there any drawbacks? I have 2 options:
    1. Create sequence primary key
    2. Or make foreign key as primary key
    Which one is better and why? I like # 2 just because I don't have to create extra index, sequence and column.

  • Many-to-one relationships

    I'm trying to implement a many-to-one relationship similar to the one, for example, between an OrderLineItem and a Product.
    I managed to create the beans and define the relationship using deploytool.
    What I'm trying to understand is how can I prevent a Product instance from being deleted when it is involved in the relationship described above?
    Currently, under Sun's reference implementation server, I am allowed to delete a Product even if there are OrderLineItems that reference it.
    There is one line printed out in the window running j2ee -verbose:
    com.sun.ejb.containers.EntityContainer$EJBTxKey
    The record in the Product table is deleted nonetheless.
    Another weird thing is that the server does not allow me to deploy two beans involved in a many-to-one relationships with the Product bean if they are using the same CMR field name. What I get is a compilation error at the deployment time.
    I'd appreciate any input.

    They way I handle this is to hide the creation/manipulation/deletion of the bean behind a manager - for example a singleton session bean. I NEVER allow the direct creation/deletion of entity beans except through manager classes. This is quite a common J2EE pattern, whose name escapes me at the moment.
    Your manager would have a method like delete(int productId), which would delete the matching Product entity bean, and would then search the OrderLineItem beans for the matching Product primary key.

  • Listing all Ogranisation Objects under one org model

    Hi
    I would like to create a list of organization(s) created under one org model.  I had searched for Organization model related tables , I could get all organization objects in table HRP1000 , but here I am having Ogr Objects other then my Organization Model as well.
    What I am looking for
    For Example : If I am having following ORG structure
    ORG Root
         ORG Region 1
         ORG Region 2
              Position 1
         ORG Region 3
              Org Region 3.1
                   Position 1
    My objective is to find a way (Table/ Report program ) to create a list of all O Org objects under ORG Root

    Olaf, JJordheim,
    Thank you for quick response. Some users will have Content Manager and possibly System Administrator, User roles.  I was wanting to know if there is a method we can prevent  these Super users from  making changes by setting
    some folder parameter value. 
    Are you stating I should remove the Content Manager and Publisher for the Super users?
    Thanks
    Joe

  • Many to one relationships strange behavior

    I have a problem with two many to one relationships.
    The problem appears from the dirty mechanism of cmr/cmp fields.
    When I have two “many-to-one” relationships ex:
    A n..1 B
    A n..1 C
    Navigability: B -> A
              A <-> C
    When I put in ejb-jar.xml the B to A relation first, the bugs appear. The dirty mechanism work chaotic. The problem is in the generated code for the PersistenceManager and Wrapper of the A bean.
    In the Wrapper the only fields with dirty mecansim are the real fields from bean which are navigable. In the PersistenceManager class are the same fields like in the BeanWrapper plus the fake fields for relationship. But the fake fields are intercalated with real fields and the dirty flag values are not the same with the dirty flags from BeanWrapper. Result: chaotic updates.
    Solution(workaround – not elegant): put first the relation which has navigability from A to C and second A to B.

    They way I handle this is to hide the creation/manipulation/deletion of the bean behind a manager - for example a singleton session bean. I NEVER allow the direct creation/deletion of entity beans except through manager classes. This is quite a common J2EE pattern, whose name escapes me at the moment.
    Your manager would have a method like delete(int productId), which would delete the matching Product entity bean, and would then search the OrderLineItem beans for the matching Product primary key.

Maybe you are looking for

  • My iPhone 4s cannot connect to my home network, can't figure out why...

    My phone recognizes my home network but cannot join it.  I have tried the option to forget the network and then gone back in and retyped in the password, but it just keeps spinning in a circle trying to connect to my home network, but never connects?

  • Extractor file name

    Hi Guru: We are extracting data from SAP via flat file approach. Is there a way to get a dynamic file name? Like we have Dev/QA/PROD systems, how to makesure after transport, we do not need to change the file location/name? Thanks a lot. Best regards

  • WLC 5508 and AIR CAP 1602I

    Hello, We've got a problem with the AP (AIR CAP 1602I) which is managed by WLC 5508(7.4.100.60) Users connect to the AP with VOIP phones(Avaya).. and there are following problems during calls -robot voice -strong noise(even if call is not made, just

  • Simplest way to send info in the background?

    What is the simplest (least amount of code) way to send info in the background. I have a bakery app that needs to send orders to the bakery. It would idealy be just a chunk of code, though I can have a large amount if necessary. Is there a background

  • Lens-blur / Tilt-shift blur grayed out for a video clip as Smart Object

    So instead of using Actions and apply the said effects to hundreds, even thousands of still frames, I was aware you can apply filters directly onto a rendered video clip in Photoshop. I followed the instructions by opening the video which I created w