Problem whit foreign key in target

I have a 2 interfaces whit the same source, one of this targets is a table whit a foreign key to the another table (in the another interface).
for example table1 and table2 - table2 has a column FK_table1.
What do put in the mapping interface in this field.
Thanks

As far an I understood it correctly:
Interface 1 - SrcTable -> Table1
Interface 2 - SrcTable -> Table2 (FK_Table1)
In this case, you will execute interfaces in order Interface 1 and then Interface 2.
In Interface 2, on the source datastore side, you will drag-drop table1 and make a join between SrcTable and Table1. And in the column for Table2, add the column from Table1.
Hope that helps

Similar Messages

  • EMIGALL : problem of foreign key

    Hi everybody
    I m working on a EMIGALL migration and i met one problem with foreign key…
    My field VKONT is defined (in specific table ZR006SAT) like a foreign key with check table FKKVK (Contract Account Header). It means that an entry can be inserted in ZR006SAT , only if VKONT value exists in FKKVK table.
    But, during the migration of my migration object ZR006SAT (same name as the table), I have no error when I put any value for my VKONT field in the input file. EMIGALL does not control the foreign key constraint and I don’t understand why (???).
    However,
    1.     when i try to insert manually (by SE11) an entry in ZR006SAT, SAP forces me to input correct value (existing in FKKVK table) for VKONT field.
    2.     for standards migration objects, there is no problem… foreign key check is working well
    3 days I ve been on this problem.
    Please help me

    Hai
    You can find detailed documentation of EMIGALL in SAP itself. Use Transaction EQ81 to display it. It provides all the concepts and procedures to work with EMIGALL. I will also prepare a document and send it to u later. Meanwhile just for ur info here are some points about EMIGALL :
    1. It Migrates data Business Object wise
    2. It uses Direct Input Technique
    3. It has more than 100 objects of IS-U
    and the steps for implementation goes like this:
    1)You have to create a user specially for migration which will have all the authorizations related to migration workbench, BASIS and IS-U
    2)You have to create your own company in EMIGALL. There is a default company called SAP.
    3)Company SAP contains all the Business Objects
    4)You have to figure out what business objects u need and then u have to copy those business objects to ur company from Standard Company SAP
    5)Each objects contains more than one structure and each structure can contain more than one fields. The relation goes like this
    Object ---> Structure ---> Field
    6)You have to define field rules for each required field of the object. You have to mark "Not required" for fields u don't need
    7)After field rules for a given object is set u have to generate load report i.e. actual Direct Input Program which will migrate data. This program is generated on basis of field rules set by u.
    8)After the load report is generated u have to prepare an input file (import File) for migration. The import file should be according to structure provided by SAP and must be in binary format. SAP Provides the structure of file according to your configurations. You have to write ur own Data conversion program(in any language) for this task.
    9)You take import file as input and migrate the data using generated load program
    10)Finally u can check the Migration Statistics and Error Log
    Regards
    Sreeni

  • Problem with Foreign Key check in an editable ALV

    Hi,
    I've implemented an editable ALV.
    The underlying context node is referenced to a structure and within the structure the foreign keys are defined.
    In my example, I have two editable columns with different foreign key checks.
    My problem is, the foreign key check works only for one column.
    So if I enter in both columns incorret values, only a message for the first column is thrown,
    but not for the second column!
    Only if I enter two errors in one(!) column (in two rows), than I get two error messages.
    Examples:
    does not work:
    COL1 | COL2
    err1  | err2   -> only one error message is displayed (for err1)
    It works in this case:
    COL1 | COL2
    err1  |  ok
    err2  |  ok
    => two messages for err1 and err2
    and in this case
    COL1 | COL2
    err1  |  ok
    ok     |  err2
    => two messages for err1 and err2
    I've found nothing in OSS. My system is a 7.00 with SP18, so OSS 1153492 is already implemented.
    Do I somenthing wrong or is this an error in SAP?
    Thanks,
    Andreas

    Hi Lekha,
    thank you very much for your support!
    I try to give you an example.
    In general, you need an editable ALV with at least two columns.
    The node for the ALV table in the component controller has to be assigned to a dictionary structure!
    That is very important, otherwise the foreign key check will not work!
    And the two fields in this dictionary structure have to be assigned to a "check table".
    Prerequisition: NW70 SP16 or higher! See oss note 1153492.
    Maybe an easy way to reproduce it is using the WD component WDT_FLIGHTLIST_EDIT.
    So copy this component to a Z-component.
    Than create a dictionary structure for the node "NODE_FLIGHTTAB" with the same 10 fields as the node attributes.
    In your new dictionary structure, assign to the fields CARRID and CONNID the check tables SCARR and SPFLI. (see table SFLIGHT).
    Than make both columens (CARRID and CONNID) editable.
    This has to be done in the "RESULTVIEW" in the method "INIT".
    You can user the following code:
      lr_column = lr_column_settings->get_column( 'CARRID' ).
      create object lr_input_field
        exporting
          value_fieldname = 'CARRID'.
      lr_column->set_cell_editor( lr_input_field ). 
      lr_column = lr_column_settings->get_column( 'CONNID' ).
      create object lr_input_field
        exporting
          value_fieldname = 'CONNID'.
      lr_column->set_cell_editor( lr_input_field ).
    Copy this code below this code:
      lr_column_settings ?= l_value.
      lr_column = lr_column_settings->get_column( 'PRICE' ).
      create object lr_input_field
        exporting
          value_fieldname = 'PRICE'.
      lr_column->set_cell_editor( lr_input_field ).
    Than just activate all,  create a Web Dynpro Application and your are ready to test it.
    To test it, do the following:
    Append/Insert an empty row.
    Enter a CARRID and CONNID that does not exist and press ENTER.
    My result: only one error message is displayed for the wrong CARRID, but no error message for CONNID!
    Insert a new row.
    Enter in the first row, column CARRID an invalid value and in the second(!) row in column CONNNID.
    Than you get two(!) error messages. That's the behavior I expect.
    So thank you very much in advance for your help!
    Regards,
    Andreas

  • Update foreign key in target

    Hello,
    My interface has a Sql Server source datastore and an XML target datastore.
    I woud like to create a sequence of values (0,1,2,3...) for the foreign key in the target. This foreign key is missing in the source datastore, hence, it cannot be mapped.
    I'm unsure about the correct way of solving this issue.
    Any help will be much appreciated...

    Ned Epstein wrote:
    It makes sense for the trigger logic to assign the foreign key column trans_request_id in the table lsu_trans_resources_t with the value of the primary key from the parent table.Why?
    Personally I disagree, and think this does not make sense. How can a trigger on the child table know under which parent key the child should be inserted? Magic?
    Of course you can make some assumptions, such as: child rows are always inserted inside the same transaction that a parent row was inserted. In which case you could refer to parent_seq.currval.
    But that, to me, sounds like an assumption you would not want to make.

  • Constraint Problem in Foreign key --- Very Urgent - Help Needed

    Hello All,
    There are 2 tables and their associated fields
    EmpProj
    Emp_id(pk)
    Proj_id (pk)
    eff_from_dt(pk)
    ProjDesc
    Proj_id(fk)
    eff_from_dt(fk)
    Proj_name
    I have created the 2 tables like shown below
    CREATE TABLE EMPPROJ
    (EMP_ID NUMBER,
    PROJ_ID NUMBER,
    eff_from_dte date,
    PRIMARY KEY(EMP_ID,PROJ_ID,EFF_FROM_DT)
    CREATE TABLE PROJDESC
    (PROJ_ID NUMBER,
    PROJ_NAME VRACHAR2(20),
    EFF_FROM_DT DATE,
    CONSTRAINT S2 FOREIGN KEY(PROJ_ID,EFF_FROM_DT) REFERENCES EMPPROJ(PROJ_ID,EFF_FROM_DT));
    Now whenever i try to create a foriegn key table it gives an error message like "No matching parent key found."
    The columns in the foreign key should be same in number, same datatype and size. you can't create a foreign key with one column for a primary key of two columns.
    What i need to do to refer only the two columns in the Primary Key by a Foreign key?
    Please suggest anyway to resolve this problem.
    Thanks in advance.
    Captain

    My question is
    The foreign key can not refer only partial column of primary key as the rule of RDMS.
    How should i achieve that by other alternatives?
    Please suggest any method.
    Thanks in advance.

  • Problem with Foreign Key relationships in SAP R/3 4.7

    Hi Experts,
    I am trying to create a foreign key relationship between 2 transparent tables in SAP R/3 4.7
    Table 1:ZAAVNDR (MANDT (pk), VENDORNO (pk), NAME, REGION, COUNTRY (fk)) Foreign Key Table
    Table 2: ZAAVNDRREF(MANDT(pk), COUNTRY (pk)) ---Check table
    I have added few valid countries in check table but when I am adding some records in foreign key table with invalid countries these records are not being restricted and are still successfully going into the table.
    Could any one please help in this.
    Thanks in anticipation.
    -Amit

    Hi Sandra,
    Many thanks for your response and providing time of yours.
    Now, I have done exactly the same thing, but still it is the same.
    I have created two new tables as below:
    ZAAVREF (Check table)
    MANDT (PK)
    COUNTRY (PK) Domain:ZAACOUNT (CHAR 10)
    ZAAV1 (Foreign key table)
    MANDT (PK)
    COUNTRY (PK) Domain:ZAACOUNT (CHAR 10)
    Then I have created FK on country of foreign key table ZAAV1 and then SE16 (for table ZAAVREF)->Create Entries-> Entered values for Country only->Save....Records entered with valid Country values.
    After that SE16 (for table ZAAV1)->Create Entries-->Entered an Invalid country->Save->Still the record entered to the Database successfully....
    Could you please let me know where I am going wrong.
    I am using SAP R/3 4.7 and creating tables using Tools->ABAP Workbench->Development->ABAP dictionary

  • Problem in Foreign key creation

    Hi,
    I have a requirement where I need to create a foreign key in a ztable which points to the SPRAS field of table T002.Now this requires that the domain of this custom field should be the same as SPRAS. But domain SPRAS has got a conversion exit.For my case, I need to have different conversion exit for the customer field.
    So can you please suggest how I can achieve both the things:-
    1.Creating a PK-FK relatioship with the table field T002-SPRAS
    2. Create a conversion-exit at the domain level of the custom field.
    Thanks,
    Samrat

    Hi,
      I am confused with your requirement.
    Lets understand why we have conversion exit ..
    Conversion Exit 1
       Ex:  Input -- 'EN'  Conversion exit would change it to 'E' and store in DB
    Conversion Exit 2
       Ex:  Input -- 'EL'  Conversion exit would change it to 'E' and store in DB
    so 2 conversion exit perform 2 separate task...Right !!!
    Now lets assume that your zfield uses conversion exit 2 and t002 uses conversion exit 1.If you create a foreign key to zfield to spras of t002
    Input - 'EL' conversion exit will convert it to 'E' and it refers to 'E' of T002 ( but 'E' in t002 is actually 'EN'.
    Isnt this wrong ??
    I hope i did not confuse you.
    Cheers,
    KD

  • Problem with foreign key in entity bean in WSED..Plzzzzz help!!!!!

    hi all,
    m very new to ejb...m crerating container managed entity bean in wsed..The steps I have followed r as follows,
    i) created 2 tables in database,one is PARENT with fields ID(Primary Key) and NAME and another is CHILD with fields ID1(Foreign Key) and NAME.
    ii)created 2 entity beans... 1st is parent with fields id(key field) and name(promote getter & setter methods to local interface)...2nd is child
    (choosed parent as bean super type) with fields id1 (promote getter & setter methods to local interface) and name (promote getter & setter methods to local interface)...
    iii)Generated EJB to RDB mapping(choosed crreate new backend folder->meet in the middle->use existing connection->choosed the tables parent & child in the database->match by name->finish)
    now m getting an error in Map.mapxmi--->"The table PARENT does not have a discriminator column"...and a warning--->"A primary key does not exist for table: CHILD in file: platform:/resource/NewFK/ejbModule/META-INF/backends/DB2UDBNT_V8_1/Map.mapxmi.     Map.mapxmi     NewFK/ejbModule/META-INF/backends/DB2UDBNT_V8_1     L/NewFK/ejbModule/META-INF/backends/DB2UDBNT_V8_1/Map.mapxmi"

    Hi Sandra,
    Many thanks for your response and providing time of yours.
    Now, I have done exactly the same thing, but still it is the same.
    I have created two new tables as below:
    ZAAVREF (Check table)
    MANDT (PK)
    COUNTRY (PK) Domain:ZAACOUNT (CHAR 10)
    ZAAV1 (Foreign key table)
    MANDT (PK)
    COUNTRY (PK) Domain:ZAACOUNT (CHAR 10)
    Then I have created FK on country of foreign key table ZAAV1 and then SE16 (for table ZAAVREF)->Create Entries-> Entered values for Country only->Save....Records entered with valid Country values.
    After that SE16 (for table ZAAV1)->Create Entries-->Entered an Invalid country->Save->Still the record entered to the Database successfully....
    Could you please let me know where I am going wrong.
    I am using SAP R/3 4.7 and creating tables using Tools->ABAP Workbench->Development->ABAP dictionary

  • Problems whit primary key = '#'

    Hello!
    I've got a problem with an application based In Forms of a Table with Report when the table primary key has the value '#'.
    From the report, when I press the 'update' button, this value is contained in the URL link with de upddate form, but all the fields in the form appear empty, so I can't update or delete this row.
    form URL example https://servername/f?p=133:10:3953379412098904::NO::P10_ID_TRAMO_FACTURACION:#
    Table definition
    LK_DMR_TRAMOS_FACTURACION
    ID_TRAMO_FACTURACION VARCHAR2(1 BYTE) NOT NULL,
    DE_TRAMO_FACTURACION VARCHAR2(50 BYTE),
    DE_LIMITE_INFERIOR NUMBER(8, 0),
    DE_LIMITE_SUPERIOR NUMBER(8, 0),
    FC_ACTUALIZACION_DMR DATE DEFAULT SYSDATE,
    ID_USUARIO_ACT_DMR VARCHAR2(20 BYTE) DEFAULT USER
    , CONSTRAINT PK_DMR_TRAMOS_FACTURACION PRIMARY KEY
    ID_TRAMO_FACTURACION
    ;

    Hi,
    character # has special meaning when used in URL - http:/server/some.htm#text means "load page some.htm and jump to place where construction <a name="text"> was placed". If there's nothing after #, browser won't jump anywhere... But # character is lost anyway.
    Solution? You can escape this character and instead of # use %23 - http://server/apex/f?p=100:1:85284257448058::::P1_X:%23
    dino

  • Urgent expalantion reqired about foreign keys

    we are doing data migration project and we have get data from different regions data in flat files, but we have problem below like:
    i am facing a problem to declare unique constraints, because in some files column should be in number data type and same file from some other region is varchar2 but these two columns are unique ,these two columns don't having the any duplicate values.
    can i take this column data type in varchar2?
    why because if i am taking number type it cant accept varchar2
    any suggestions.................
    Regards,
    sh

    sh wrote:
    we are doing data migration project and we have get data from different regions data in flat files, but we have problem below like:
    i am facing a problem to declare unique constraints, because in some files column should be in number data type and same file from some other region is varchar2 but these two columns are unique ,these two columns don't having the any duplicate values.
    can i take this column data type in varchar2?
    why because if i am taking number type it cant accept varchar2
    any suggestions.................
    Regards,
    shNot really sure i understand your question. If you have 2 data sources and 2 different data types for the same type of data then you'd want to ensure you do a TO_NUMBER on the character representation of the data to ensure you strip out any non-printing characters like tabs or spaces.
    If that's not your problem, please try to be a little more clear. Your subject mentions you have an urgent problem about foreign keys and i find nothing to support your claim of urgency, nor foreign keys, within the subject of your question.
    Cheers,

  • Caching problem w/ primary-foreign key mapping

    I have seen this a couple of times now. It is not consistent enough to
    create a simple reproducible test case, so I will have to describe it to you
    with an example and hope you can track it down. It only occurs when caching
    is enabled.
    Here are the classes:
    class C1 { int id; C2 c2; }
    class C2 { int id; C1 c1; }
    Each class uses application identity using static nested Id classes: C1.Id
    and C2.Id. What is unusual is that the same value is used for both
    instances:
    int id = nextId();
    C1 c1 = new C1(id);
    C2 c2 = new C2(id);
    c1.c2 = c2;
    c2.c1 = c1;
    This all works fine using optimistic transactions with caching disabled.
    Although the integer values are the same, the oids are unique because each
    class defines its own unique oid class.
    Here is the schema and mapping (this works with caching disabled but fails
    with caching enabled):
    table t1: column id integer, column revision integer, primary key (id)
    table t2: column id integer, column revision integer, primary key (id)
    <jdo>
    <package name="test">
    <class name="C1" objectid-class="C1$Id">
    <extension vendor-name="kodo" key="jdbc-class-map" value="base">
    <extension vendor-name="kodo" key="table" value="t1"/>
    </extension>
    <extension vendor-name="kodo" key="jdbc-version-ind"
    value="version-number">
    <extension vendor-name="kodo" key="column" value="revision"/>
    </extension>
    <field name="id" primary-key="true">
    <extension vendor-name="kodo" key="jdbc-field-map" value="value">
    <extension vendor-name="kodo" key="column" value="id"/>
    </extension>
    </field>
    <field name="c2">
    <extension vendor-name="kodo" key="jdbc-field-map" value="one-one">
    <extension vendor-name="kodo" key="column.id" value="id"/>
    </extension>
    </field>
    </class>
    <class name="C2" objectid-class="C2$Id">
    <extension vendor-name="kodo" key="jdbc-class-map" value="base">
    <extension vendor-name="kodo" key="table" value="t2"/>
    </extension>
    <extension vendor-name="kodo" key="jdbc-version-ind"
    value="version-number">
    <extension vendor-name="kodo" key="column" value="revision"/>
    </extension>
    <field name="id" primary-key="true">
    <extension vendor-name="kodo" key="jdbc-field-map" value="value">
    <extension vendor-name="kodo" key="column" value="id"/>
    </extension>
    </field>
    <field name="c1">
    <extension vendor-name="kodo" key="dependent" value="true"/>
    <extension vendor-name="kodo" key="inverse-owner" value="c2"/>
    <extension vendor-name="kodo" key="jdbc-field-map" value="one-one">
    <extension vendor-name="kodo" key="table" value="t1"/>
    <extension vendor-name="kodo" key="ref-column.id" value="id"/>
    <extension vendor-name="kodo" key="column.id" value="id"/>
    </extension>
    </field>
    </class>
    </package>
    </jdo>
    Because the ids are known to be the same, the primary key values are also
    used as foreign key values. Accessing C2.c1 is always non-null when caching
    is disabled. With caching is enabled C2.c1 is usually non-null but sometimes
    null. When it is null we get warnings about dangling references to deleted
    instances with id values of 0 and other similar warnings.
    The workaround is to add a redundant column with the same value. For some
    reason this works around the caching problem (this is unnecessary with
    caching disabled):
    table t1: column id integer, column id2 integer, column revision integer,
    primary key (id), unique index (id2)
    table t2: column id integer, column revision integer, primary key (id)
    <jdo>
    <package name="test">
    <class name="C1" objectid-class="C1$Id">
    <extension vendor-name="kodo" key="jdbc-class-map" value="base">
    <extension vendor-name="kodo" key="table" value="t1"/>
    </extension>
    <extension vendor-name="kodo" key="jdbc-version-ind"
    value="version-number">
    <extension vendor-name="kodo" key="column" value="revision"/>
    </extension>
    <field name="id" primary-key="true">
    <extension vendor-name="kodo" key="jdbc-field-map" value="value">
    <extension vendor-name="kodo" key="column" value="id"/>
    </extension>
    </field>
    <field name="c2">
    <extension vendor-name="kodo" key="jdbc-field-map" value="one-one">
    <extension vendor-name="kodo" key="column.id" value="id2"/>
    </extension>
    </field>
    </class>
    <class name="C2" objectid-class="C2$Id">
    <extension vendor-name="kodo" key="jdbc-class-map" value="base">
    <extension vendor-name="kodo" key="table" value="t2"/>
    </extension>
    <extension vendor-name="kodo" key="jdbc-version-ind"
    value="version-number">
    <extension vendor-name="kodo" key="column" value="revision"/>
    </extension>
    <field name="id" primary-key="true">
    <extension vendor-name="kodo" key="jdbc-field-map" value="value">
    <extension vendor-name="kodo" key="column" value="id"/>
    </extension>
    </field>
    <field name="c1">
    <extension vendor-name="kodo" key="dependent" value="true"/>
    <extension vendor-name="kodo" key="inverse-owner" value="c2"/>
    <extension vendor-name="kodo" key="jdbc-field-map" value="one-one">
    <extension vendor-name="kodo" key="table" value="t1"/>
    <extension vendor-name="kodo" key="ref-column.id" value="id2"/>
    <extension vendor-name="kodo" key="column.id" value="id"/>
    </extension>
    </field>
    </class>
    </package>
    </jdo>
    Needless to say, the extra column adds a lot of overhead, including the
    addition of a second unique index, for no value other than working around
    the caching defect.

    Tom-
    The first thing that I think of whenever I see a problem like this is
    that the equals() and hashCode() methods of your application identity
    classes are not correct. Can you check them to ensure that they are
    written in accordance to the guidelines at:
    http://docs.solarmetric.com/manual.html#jdo_overview_pc_identity_application
    If that doesn't help address the problem, can you post the code for your
    application identity classes so we can double-check, and we will try to
    determine what might be causing the problem.
    In article <[email protected]>, Tom Landon wrote:
    I have seen this a couple of times now. It is not consistent enough to
    create a simple reproducible test case, so I will have to describe it to you
    with an example and hope you can track it down. It only occurs when caching
    is enabled.
    Here are the classes:
    class C1 { int id; C2 c2; }
    class C2 { int id; C1 c1; }
    Each class uses application identity using static nested Id classes: C1.Id
    and C2.Id. What is unusual is that the same value is used for both
    instances:
    int id = nextId();
    C1 c1 = new C1(id);
    C2 c2 = new C2(id);
    c1.c2 = c2;
    c2.c1 = c1;
    This all works fine using optimistic transactions with caching disabled.
    Although the integer values are the same, the oids are unique because each
    class defines its own unique oid class.
    Here is the schema and mapping (this works with caching disabled but fails
    with caching enabled):
    table t1: column id integer, column revision integer, primary key (id)
    table t2: column id integer, column revision integer, primary key (id)
    <jdo>
    <package name="test">
    <class name="C1" objectid-class="C1$Id">
    <extension vendor-name="kodo" key="jdbc-class-map" value="base">
    <extension vendor-name="kodo" key="table" value="t1"/>
    </extension>
    <extension vendor-name="kodo" key="jdbc-version-ind"
    value="version-number">
    <extension vendor-name="kodo" key="column" value="revision"/>
    </extension>
    <field name="id" primary-key="true">
    <extension vendor-name="kodo" key="jdbc-field-map" value="value">
    <extension vendor-name="kodo" key="column" value="id"/>
    </extension>
    </field>
    <field name="c2">
    <extension vendor-name="kodo" key="jdbc-field-map" value="one-one">
    <extension vendor-name="kodo" key="column.id" value="id"/>
    </extension>
    </field>
    </class>
    <class name="C2" objectid-class="C2$Id">
    <extension vendor-name="kodo" key="jdbc-class-map" value="base">
    <extension vendor-name="kodo" key="table" value="t2"/>
    </extension>
    <extension vendor-name="kodo" key="jdbc-version-ind"
    value="version-number">
    <extension vendor-name="kodo" key="column" value="revision"/>
    </extension>
    <field name="id" primary-key="true">
    <extension vendor-name="kodo" key="jdbc-field-map" value="value">
    <extension vendor-name="kodo" key="column" value="id"/>
    </extension>
    </field>
    <field name="c1">
    <extension vendor-name="kodo" key="dependent" value="true"/>
    <extension vendor-name="kodo" key="inverse-owner" value="c2"/>
    <extension vendor-name="kodo" key="jdbc-field-map" value="one-one">
    <extension vendor-name="kodo" key="table" value="t1"/>
    <extension vendor-name="kodo" key="ref-column.id" value="id"/>
    <extension vendor-name="kodo" key="column.id" value="id"/>
    </extension>
    </field>
    </class>
    </package>
    </jdo>
    Because the ids are known to be the same, the primary key values are also
    used as foreign key values. Accessing C2.c1 is always non-null when caching
    is disabled. With caching is enabled C2.c1 is usually non-null but sometimes
    null. When it is null we get warnings about dangling references to deleted
    instances with id values of 0 and other similar warnings.
    The workaround is to add a redundant column with the same value. For some
    reason this works around the caching problem (this is unnecessary with
    caching disabled):
    table t1: column id integer, column id2 integer, column revision integer,
    primary key (id), unique index (id2)
    table t2: column id integer, column revision integer, primary key (id)
    <jdo>
    <package name="test">
    <class name="C1" objectid-class="C1$Id">
    <extension vendor-name="kodo" key="jdbc-class-map" value="base">
    <extension vendor-name="kodo" key="table" value="t1"/>
    </extension>
    <extension vendor-name="kodo" key="jdbc-version-ind"
    value="version-number">
    <extension vendor-name="kodo" key="column" value="revision"/>
    </extension>
    <field name="id" primary-key="true">
    <extension vendor-name="kodo" key="jdbc-field-map" value="value">
    <extension vendor-name="kodo" key="column" value="id"/>
    </extension>
    </field>
    <field name="c2">
    <extension vendor-name="kodo" key="jdbc-field-map" value="one-one">
    <extension vendor-name="kodo" key="column.id" value="id2"/>
    </extension>
    </field>
    </class>
    <class name="C2" objectid-class="C2$Id">
    <extension vendor-name="kodo" key="jdbc-class-map" value="base">
    <extension vendor-name="kodo" key="table" value="t2"/>
    </extension>
    <extension vendor-name="kodo" key="jdbc-version-ind"
    value="version-number">
    <extension vendor-name="kodo" key="column" value="revision"/>
    </extension>
    <field name="id" primary-key="true">
    <extension vendor-name="kodo" key="jdbc-field-map" value="value">
    <extension vendor-name="kodo" key="column" value="id"/>
    </extension>
    </field>
    <field name="c1">
    <extension vendor-name="kodo" key="dependent" value="true"/>
    <extension vendor-name="kodo" key="inverse-owner" value="c2"/>
    <extension vendor-name="kodo" key="jdbc-field-map" value="one-one">
    <extension vendor-name="kodo" key="table" value="t1"/>
    <extension vendor-name="kodo" key="ref-column.id" value="id2"/>
    <extension vendor-name="kodo" key="column.id" value="id"/>
    </extension>
    </field>
    </class>
    </package>
    </jdo>
    Needless to say, the extra column adds a lot of overhead, including the
    addition of a second unique index, for no value other than working around
    the caching defect.
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • Legacy Mapping Problem: Compound PK is Foreign Key

    My job is to map beans using JPA onto a legacy database schema that must not get modified. I am stuck with doing the relation between two tables.
    The schema is:
    CREATE TABLE A (
         a1 INTEGER NOT NULL,
         a2 INTEGER NOT NULL,
         PRIMARY KEY (a1, a2)
    CREATE TABLE B (
         b1 INTEGER NOT NULL,
         b2 INTEGER NOT NULL,
         b3 INTEGER NOT NULL,
         FOREIGN KEY f (b1, b2) REFERENCES A (a1, b2) ON UPDATE CASCADE ON DELETE CASCADE,
         PRIMARY KEY (b1, b2, b3)
    )As you can see, both tables have compound primary keys, and the primary key of table B contains a foreign key to table A. This is typical in our DB because B in fact acts like a "inner table" (in the sense of "inner class") to A.
    So far I defined both classes and provided a primary key, but the question now is, how to provide the relation between both? The relation shall be unidirectional, so that I can query all Bs belonging to one A by "myA.getBs(): Collection".
    The code I have written so far is:
    @Entity
    public class A {
         @EmbeddedId
         private APK primaryKey;
         @OneToMany
         private Collection<B> characteristics;
    @Embeddable
    public class APK {
         private String a1;
         private String a2;
    @Entity
    public class B {
         @EmbeddedId
         private BPK primaryKey;
    @Embeddable
    public class BPK {
         private String b1;
         private String b2;
         private String b3;
    }Unfortunately that is not working, because the JPA Provider (here: TopLink Essentials) tries to map the relationship on a third table named "A_B" that actually is not there.
    So how to tell TopLink to find the mapping information in table B (just like using the foreign key f)?
    Please help, I am driving nuts!

    OK
    So i found out the real problem
    And the problem is that my CustomerHistory has a Text Field, as in a MS SQL Server TEXT Field
    When i changed it to a VARCHAR, it started working
    The strangest thing is that Customer also has a TEXT Field (mapped to a String) and i can do Finds without any problems
    So my question now is how can i work with TEXT in CMPs ?
    Thanks

  • Mapping problem with compressed key update record (target format)...

    Hi Guys,
    Getting below error while replication from Source to target. Source table is having NOT NULL Column, but on target replicat process giving error about some NULL value ??
    How to overcome this issue, any idea...
    2011-08-04 10:35:04 INFO OGG-00995 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: REPLICAT RMASTRK starting.
    2011-08-04 10:35:05 INFO OGG-00996 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: REPLICAT RMASTRK started.
    2011-08-04 10:35:06 WARNING OGG-00869 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: OCI Error ORA-01407: cannot update ("INFRA"."CUST"."CODE") to NULL (status = 1407), SQL <UPDATE "INFRA"."CUST" SET "ORD_ID" = :a2,"DP_ID" = :a3,"EXCHNG_CODE" = :a4,"ORD_QTY" = :a5,"ORD_PRICE" = :a6,"CODE" = :a7,"MKRT_CODE" = :a8,"CHANN>.
    2011-08-04 10:35:06 WARNING OGG-01004 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: Aborted grouped transaction on 'INFRA.CUST', Database error 1407 (ORA-01407: cannot update ("INFRA"."CUST"."SCRP_CODE") to NULL).
    2011-08-04 10:35:06 WARNING OGG-01003 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: Repositioning to rba 44132192 in seqno 68708.
    2011-08-04 10:35:06 *WARNING OGG-01154 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: SQL error 1407 mapping INFRA.CUST to INFRA.CUST OCI Error ORA-01407:* *cannot update ("INFRA"."CUST"."SCRP_CODE") to NULL (status = 1407), SQL <UPDATE "INFRA"."CUST" SET "ORD_ID" = :a2,"DP_ID" = :a3,"EXCHNG_CODE"=:a4,"ORD_QTY"*
    *= :a5,"ORD_PRICE" = :a6,"SCRP_CODE" = :a7,"MKRT_CODE" = :a8,"CHANN>.*
    2011-08-04 10:35:06 WARNING OGG-01003 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: Repositioning to rba 44132192 in seqno 68708.
    2011-08-04 10:35:06 ERROR OGG-01296 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: Error mapping from INFRA.CUST to INFRA.CUST.
    2011-08-04 10:35:06 ERROR OGG-01668 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: PROCESS ABENDING.
    Oracle GoldenGate Delivery for Oracle process started, group RMASTRK discard file opened: 2011-08-04 10:35:05
    Current time: 2011-08-04 10:35:06
    Discarded record from action ABEND on error 1407
    OCI Error ORA-01407: cannot update ("INFRA"."CUST"."SCRP_CODE") to NULL
    (status = 1407), SQL <UPDATE "INFRA"."CUST" SET "ORD_ID" = :a2,"MKRT_CODE" = :a8,"CHANN>
    Aborting transaction on ./dirdat/pm beginning at seqno 68708 rba 44132192
    error at seqno 68708 rba 44132192
    Problem replicating INFRA.CUST to INFRA.CUST
    *Mapping problem with compressed key update record (target format)...*
    ORD_QTY = 500
    ORD_PRICE = 37430
    SCRP_CODE =
    MKRT_CODE = N
    Oracle GoldenGate Delivery for Oracle process started, group RMASTRK discard file opened: 2011-08-
    04 10:35:05
    Current time: 2011-08-04 10:35:06
    Discarded record from action ABEND on error 1407
    OCI Error ORA-01407: cannot update ("INFRA"."CUST"."SCRP_CODE") to NULL
    (status = 1407), SQL <UPDATE "INFRA"."CUST" SET "ORD_ID" = :a2,"MKRT_CODE" = :a8,"CHANN>
    Aborting transaction on ./dirdat/pm beginning at seqno 68708 rba 44132192
    error at seqno 68708 rba 44132192
    Problem replicating INFRA.CUST to INFRA.CUST
    Mapping problem with compressed key update record (target format)...
    ORD_QTY = 500
    ORD_PRICE = 37430
    SCRP_CODE =
    MKRT_CODE = N
    Any inputs / help would be appreciated.
    Regards,
    Manish

    The SCRP_CODE column has a NOT NULL constraint. The ORA-01407 error is telling you that you cannot update or set a value for this column to null because of the constraint. This has absolutely nothing to do with an index. You can use a marker/sentinel value in lieu of using NULL. For a numeric field, where everything is positive, a negative value (-1) can be decoded as meaning null. For a character field, a code such as NA can represent NULL.
    This also has nothing to do (directly) with GoldenGate failing because of this error. The underlying SQL statement will fail everywhere, regardless of the tool or application. It is not a case of failing only in GoldenGate.

  • Problem with foreign and primary keys migration from SQL Server to Oracle

    Hi folks, i'm using SQL Developer to migrate from a SQL Server database to Oracle and i'm stuck with a couple issues:
    The worst of them so far is the fact that i can't migrate any of the PKs and FKs. After successfully capturing the SQL Server DB model and converting it to Oracle, when the tool generates the scripts, all ALTER TABLE queries that add the PKs and FKs have their target columns duplicated.
    for example: when i'm trying to migrate a simple table that contains an Id (PK) and Name columns, the tool generates the following scripts:
    PROMPT Creating Table TestTable...
    CREATE TABLE TestTable (
    Id NUMBER(10,0) NOT NULL,
    Name VARCHAR2 NOT NULL
    PROMPT Creating Primary Key Constraint PK_TestTable on table TestTable ...
    ALTER TABLE TestTable
    ADD CONSTRAINT PK_TestTable PRIMARY KEY
    Id,
    Id
    ENABLE
    As for the FKs, the tool duplicates the columns as well:
    ALTER TABLE SomeTable
    ADD CONSTRAINT FK_SomeTable_SomeTable2 FOREIGN KEY
    SomeTable2Id,
    SomeTable2Id
    REFERENCES SomeTable2
    Id,
    Id
    ENABLE
    Does anyone have a clue on how to solve these issues? I'd be greatly thankful for any answers!

    Hi Fernando,
    I was unable to replicate this issue. My primary / foreign keys where defined using unique columns.
    PROMPT Creating Primary Key Constraint PK_Suppliers on table Suppliers ...
    ALTER TABLE Suppliers
    ADD CONSTRAINT PK_Suppliers PRIMARY KEY
    SupplierID
    ENABLE
    I tried a few things like
    capturing twice and renaming both models the same
    renaming the converted models
    but with no luck.
    I think this issue is occuring either at the capture or convert phase.
    1) Are you performing the capture online or offline?
    2) Can you provide a the entire DDL for one of these tables and its indexes to see if I can replicate?
    3) Did the capture or convert fail or have to be redone at any stage ?
    I all else fails I would attempt a capture and convert again using a brand new repository (create a new schema in Oracle and associate the migration repository with it).
    Regards,
    Dermot
    SQL Developer Team
    Edited by: Dermot ONeill on Oct 22, 2009 12:18 PM

  • Problem to insert id into the foreign key  php/mysql

    Hello all,
    I'm having rouble to understand the process and there is no tutorial about my problem anywhere
    I have two table:
    Table 1 (member) with id, name, phone etc
    Table2 (post) add_id, title, description, price, member_id
    I got a form to post the add and I need to insert the id of table 1 into my table 2 member_id zone
    Fisrt I did the recorset to get user id
    $colname_rsMember = "-1";
    if (isset($_SESSION['MM_Username'])) {
      $colname_rsMember = $_SESSION['MM_Username'];
    mysql_select_db($database_connect, $connect);
    $query_rsMember = sprintf("SELECT * FROM member WHERE username='".$_SESSION['MM_Username']."'")or die(mysql_error());
    $rsMember = mysql_query($query_rsMember, $connect) or die(mysql_error());
    $row_rsMember = mysql_fetch_assoc($rsMember);
    $totalRows_rsMember = mysql_num_rows($rsMember);
    This part is working and I'm able to retreive info via echo just for testing
    After this code I have my insert code
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) {
      $insertSQL = sprintf("INSERT INTO add (title, `description`, price, member_id) VALUES (%s, %s, %s, %s)",
                           GetSQLValueString($_POST['title'], "text"),
                           GetSQLValueString($_POST['description'], "text"),
                           GetSQLValueString($_POST['price'], "text"),
                           GetSQLValueString($_POST['member_id'], "int"));
      mysql_select_db($database_connect, $connect);
      $Result1 = mysql_query($insertSQL, $connect) or die(mysql_error());
      $insertGoTo = "ok.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $insertGoTo));
    Do I need to include hidden field in y form?
    I'm having the same error message. Col member_id can't not be null
    Any idea what I'm doing wrong?
    Thank You!

    When someone logs in, Dreamweaver creates a session variable called $_SESSION['MM_Username']. Use that session variable to create a recordset to get the user's ID, which can then be entered into the foreign key field of the child table.
    Dreamweaver automatically puts the code for recordsets immediately above the DOCTYPE declaration, so you will need to move it above the code for the Insert Record server behavior. So, it needs to be in this order:
    Recordset to get user ID
    Insert Record for child table

Maybe you are looking for

  • I am trying to print a passport sized headshot and I get a full page photo. How to I print out a smaller size?

    I am trying to print a passport sized headshot and I get a full page photo isntead. I downloaded the shot from i photo and chose "small" but it didn't help. I also cropped the photo on iphoto to the dorrect size but no difference. I have a Canon MX 8

  • How can i get the unitOfWork or the persisting object in to my listener???.

    hi, i have a listener class which extends SessionEventAdapter ....as shown below public class MyLister extends SessionEventAdapter{ public void postCommitUnitOfWork(SessionEvent event) { System.out.println("POST COMMIT OF WORK"); // How can i get the

  • Oracle ActiveSync Adapter issue

    Hi, I am facing an issue with oracle activeSync adapter. I am trying to connect to an oracle table and pull some records into IDM. I created the resource and tested connection to the resource and everything seems to work fine. Also I am able to poll

  • BI Publisher - No "Admin" tab

    I am working on the BI Publisher tutorials online and when I log into the web interface for BI Publisher as Administrator, I do not see an "Admin" tab. I am guessing that somehow Administrator does not have full admin privileges. Does anyone know how

  • .ibooks format on iPad Mini?

    Hi Does anyone know if it's possible to view a book in .ibooks format on the iPad Mini? I was under the impression that the iBooks app for the Mini was similar to the iPhone - works with epub and PDF, but not .ibooks Thx Jenny