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

Similar Messages

  • Mapping error at deployment with foreign key data rule

    I have created data rules for enabling foreign key constraints. There are 4 foreign key constraints on the fact table.
    For the 1st foreign key ... its a single key match key1 on table 1
    For the others, its a composite key .. key1 and key2 on table 2
    key1 and key3 on table 3
    key1 and key4 on table 4
    When I implement with the single key foreign key constraint the mapping works fine. But when I apply the other foreign key data rules for composite keys, I get the following message while deploying ....
    M_CNT Create Warning ORA-06550: line 209, column 3:
    PL/SQL: ORA-00909: invalid number of arguments
    M_CNT Create Warning ORA-06550: line 520, column 65530:
    PL/SQL: SQL Statement ignored
    M_CNT Create Warning ORA-06550: line 56, column 65530:
    PL/SQL: SQL Statement ignored
    M_CNT Create Warning ORA-06550: line 673, column 3:
    PL/SQL: ORA-00909: invalid number of arguments
    The data rule setup done is type Referential
    Specify the number of attributes in row relationship - 2
    Specify the referencing cardinality of row relationship
    Minimum Count 1 Maximum Count n
    Specify the referenced cardinality of row relationship
    Minimum Count 1 Maximum Count n
    What is it that I am doing wrong ?
    Any suggestions. Help !!!!
    Regards,
    AW

    Hi AW,
    How can I overcome this situation ?The best solution as suggested by Jörg is use of surrogate keys.
    For every production key (composite or single) generate a corresponding surrogate key using sequence operator in staging area.
    This will not just solve your problem but it will be faster also (the joins will be faster with system-generated sequence numbers),
    In a data warehouse use of production keys as primary key for linking with (foreign key) is not recommended, keep the production keys as additional attributes.
    Regards,

  • Problem creating table with foreign key in SQL Workshop

    Application Express version 2.2.1.00.04
    Get error message "Number of referencing columns/data types must match referenced columns"
    Master table SLS_SUPPLIERS has primary key SLS_ID NUMBER(8,0) and when creating table SLS_PRODUCTS with FK SLS_SLP_ID NUMBER(8,0) using the create table wizard I get the above error.
    The name of the FK is SLP_SLS_FK, key column is SLP_SLS_ID, referenced table is SLS_SUPPLIERS and referenced column is SLS_ID.
    Any help is much appreciated.
    James Edey
    I should add that if I create the table without the foreign key constraint and then create the constraint separately in SQL Workshop then it creates OK. It only fails in the create table wizard dialog.
    Message was edited by:
    edeyje
    Obviously no-one interested in this - just thought it may be a bug in v2.2 that the development team would find useful.
    James
    Message was edited by:
    edeyje

    I replied to the other thread on this too -
    there is a bug on that page when you click Next. If you define more than one fk but then navigate using the links on the process chart on the left (Constraints, Confirm, etc), the page works fine. We do have a bug on this now and I just added the notes I will need to get this fixed in 3.1 (I have already assigned it to me - must have some rogue validation that fires on next).
    Sorry it took so long for this to get noticed - I am glad I checked the forum this morning -
    -- Sharon

  • Reconcile of foreign key

    I`m using Designer 2.1.2 or 6.0. When generating a table to a database where this table already exists, I receive a report sayng that de FK`s for the table do not exist on the database. My problem is that the foreign key exists just as it is defined in the Designer. Does anybody know what is happening?

    Hi Arun,
    I see your perspective, but OAF is built on a separate architecture than forms and handling of many functionalities are different here. As far as I understand in OA Framework, whenever a row is created you need to write code to set the Primary Key (may be in Create method of EO or something else). Hope that clarifies.
    Regards
    Sumit

  • JPA: @ManyToOne legacy mapping using @JoinTable

    Dear JEE experts,
    I have a tough legacy mapping problem. There are two entities Pac and BasePac where each Pac has a BasePac field which is to be queried from the other entity table. The association is definied in a third table pac_component which has a Pac and a BasePac field among several others. I think the schema is a bit weird and I would have defined it differently, but I cannot change it because other applications using the database must not be changed.
    My code looks like this:
    @javax.persistence.Entity(name="Pacs")
    @javax.persistence.Table(name="packet")
    @javax.persistence.SequenceGenerator(name="PacsSeqGen", sequenceName="packet_packet_id_seq")
    public class Pac
         implements java.io.Serializable
        // virtual attribute basePac
        @javax.persistence.ManyToOne(fetch=EAGER, optional=true) // optional should be default anyway
        @javax.persistence.JoinTable(
             name="packet_component",
             [email protected](name="packet_id"),
             [email protected](name="basepacket_id") )
        private BasePac basePac;
        public BasePac getBasePac() { return basePac; }
        public void setBasePac( BasePac basePac ) { this.basePac = basePac; }
    @javax.persistence.Entity(name="BasePacs")
    @javax.persistence.Table(name="basepacket")
    @javax.persistence.SequenceGenerator(name="BasePacsSeqGen", sequenceName="basepacket_basepacket_id_seq")
    public class BasePac
         implements java.io.Serializable
    { ... }The Entity for pac_component does not appear so far and afaik it does not matter.
    When I now create a Pac instance and persist it, JPA (with Hibernate) always wants to create a link object:
    insert into pac_component (basepacket_id, packet_id) values (?, ?)Where the ? for basepacket_id is null. But this is not a valid row for pac_component, thus I will get a ConstaintViolationException.
    My question is: Why does it create this row at all? The association is marked optional!
    My solution might be to make the field PacBase within Pac transient and access it only through a pacComponents field, which is a @OneToMany but every assiciated PacComponent entity refers to the same BasePac. Anyway, I wonder why JPA or Hibernate wants to create such a row at all.
    ... MIchael

    I wouldn't focus too much on wanting to solve this through JPA. What you have here is a 'problem' which you will run into in many forms - your business requirements do not map directly to the data layer. This simply means that you need some business logic to make the translation. For example if this were for a web layer I would implement a specialized bean which can take different entities and then provide an alternative view on the data, optionally by generating it.
    If 'calculated' data is closely tied to the database layer and less to the business layer then you could of course choose to fix it through the database itself - by creating a view and mapping an entity to that. That is especially useful if you need the same data in multiple aspects of the application framework and not only in the Java code (think of reporting and analysis for example), but it has other considerations like performance.

  • CDR-21605, but not without a foreign key

    Hello All,
    I am working with Designer 9.0.2.96.6 and generating some forms that were proted from a previous designer version. Most of the forms are ok, but some are not.
    They give the following error:
    Message
    CDR-21605: Failed while processing Module F_CF_COD in function cfbbsa() :671 BOF cfbbs
    Cause
    The generator failed due to an unexpected error - the
    error indicates the object the generator was processing
    when it failed.
    Action
    These forms use two tables that are joined using a foreign key.
    I have created a copy of the form and it didn't work either. Then when I disabled the foreign key that is used in the table, and regenerate the form, it works ok.
    The problem is that the foreign key is used to get referential integrity.
    Does anyone have any idea or direction to solve this problem?
    Mark

    Are we generating Master-Detail Form or Base Table with lookup form? Please give more details, such as the schema definition, the Module Data Diagram, i.e. which is the base table, which is the reference table.
    For Master-Detail table, you need to define the Context value of the master table in order to populate the values of the detail table in the detail block of the generated form.

  • 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

  • Problems with ViaVoice under Leopard, especially key mapping problems

    ViaVoice's behavior has changed considerably under Leopard. First I will discuss the key mapping problem, since I'm eagerly looking for an answer to this problem. At the end of this post, I will voice some of the other problems I've experienced for those who may be interested. The key mapping problem may be specific to the fact that I use a foreign keyboard with a US version of ViaVoice.
    INTRO:
    I have used ViaVoice on my Mac for years, more or less without problems (ViaVoice's bugginess is notorious).
    Those who know ViaVoice will know that one has two general options for dictation. One can dictate into ViaVoice's so-called SpeakPad, which allows special formatting, editing and dictation error correction within the dictated text, or one can dictate into "external" software such as Microsoft Word, in which case ViaVoice just sends a string of characters to that software. SpeakPad appears to make strong use of the operating system's built-in functionality for character formatting, document formatting, etc.
    *MY PROBLEM*
    I have a German keyboard on my PowerBook, yet dictate in US English. When I dictated into SpeakPad under Tiger, all characters appeared correctly. However, when I dictated into Microsoft Word using Tiger, I had to switch the keyboard mapping from German to US to get all characters (that means including the characters that are located at different positions on a German keyboard than they are on a US keyboard such as y, z, apostrophes and parentheses) to appear correctly.
    Under Leopard, things have changed. Now it doesn't matter whether I dictate into SpeakPad or Word; the results are the same and many characters do not appear correctly.
    If set to a German keyboard, y and z appear as expected. To name a few irregularities:
    "(" appears as ")"
    ")" appears as "="
    apostrophes appear as "#" and
    ";" appears as ","
    If set to a US keyboard, y and z are interchanged. "(" and ")" appear as expected. Apostrophes appear as "\" and ";" appears as ","
    By comparison, if typed (as opposed to dictated, as in the examples above) "correctly" (i.e. based on the letters printed on the keyboard) on a German keyboard set to imitate a US keyboard:
    y and z are interchanged
    apostrophes appear as "|"
    "(" appears as "*"
    ")" appears as "(" and
    ";" appears as the symbol for "less than"
    Since I don't have a US keyboard, I can't say how it would behave if set to imitate a German keyboard, i.e. if there's a correlation to the results I get when I dictate.
    Since I was previously able to dictate correctly into SpeakPad by setting the keyboard to "German" and into Word by setting the keyboard to "US," I presume that this is a problem in Leopard, not ViaVoice.
    *OTHER PROBLEMS WITH VIAVOICE UNDER LEOPARD*
    In addition to the aforementioned key mapping problems (that may be specific to those of us with foreign keyboards), ViaVoice appears to have lost considerable functionality in Leopard. I cannot access SpeakPad's Preferences and the correction window. Moreover, the traffic-light like window buttons have disappeared from the VoiceCenter (although they work if you click where they should be). SetupAssistent appears to function.
    I've written to Nuance about these problems, but have little hope that they will invest the time in producing a patch since they haven't released any updates since 2003.

    Thrums1,
    I've never had to "register" ViaVoice after updating the system. I thus suspect you haven't fully followed my above, three-step advice (particularly step 3).
    1) Reinstall ViaVoice from CD.
    2) Update to the latest version (using the patch downloadable from Nuance's website).
    3) Replace the “temp” and “users” folders (in the "ViaVoice" folder at the upper level of your home directory) by a previous copy thereof. When I say previous copy, I mean a copy from when ViaVoice was still working properly, e.g. a copy from when it was running under Tiger.
    As I said, I've gotten ViaVoice to survive several system updates by following the above steps. To my knowledge, the last step is critical since it saves you from having to reconfigure ViaVoice under the new operating system (in this case Leopard). I suspect that ViaVoice is crashing on your system because it's trying to start some module of the SetUpAssistant that is incompatible with Leopard (as many are). If you instead use old copies of the "temp" and "users" folders (from the previous system), then ViaVoice doesn't have to go through the initial "registration" process; ViaVoice doesn't need the SetUpAssistant; and all is (more or less) fine.
    Good luck!
    BTW, to my knowledge, Dictate only runs on Intel Macs. It thus won't run on a G4 iBook, just as it won't run on my PowerBook G4.

  • Mapping Tool foreign keys

    <field name="employee">
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="one-one">
    <extension vendor-name="kodo" key="column.ID" value="EMPLOYEE_ID"/>
    </extension>
    </field>
    Hello all,
    If I have the above field defined for one my classes in package.jdo,
    should the mapping tools create the foreign keys automatically?
    Thanks.

    Hi Marc,
    Thanks for the reply.
    I tried using null and cascade for the value of the jdbc-delete-action. I
    also added the property kodo.jdbc.ForeignKeyConstraints: true to
    kodo.properties. In all cases the foreign key is showing up in the
    schema, but not getting inserted into the database, MySQL with jdbc
    driver version 3.0.15ga.
    A more worrying issue to me is that fact that the joins are not showing up
    in the schema. From what I understood from section 7.5.1 of the
    documentation the one-one jdbc-field-map extension should add the joins.
    My code still works I am just a little miffed as to why the joins are not
    showing up. They do not show up for other types of jdbc-field-map, for
    collections, as I would expect.
    I'm pasting below the meta-data for the class in question plus the portion
    of the schema.xml for that class. (If you need the full schema.xml and
    meta-data please supply an email address I can send it to, as I do not
    want to post this information on an open forum).
    I'm also posting below the output of the mapping tool. Please tell me if
    there is anything else you need.
    Cheers.
    <class name="TripImpJdo"
    persistence-capable-superclass="trekwatch.core.security.AbstractPolicedObject"
    objectid-class="TripImpJdoId">
    <extension vendor-name="kodo" key="data-cache-timeout"
    value="-1"/>
    <extension vendor-name="kodo" key="jdbc-class-ind"
    value="in-class-name">
    <extension vendor-name="kodo" key="column"
    value="JDOCLASS"/>
    </extension>
    <extension vendor-name="kodo" key="jdbc-class-map"
    value="base">
    <extension vendor-name="kodo" key="table"
    value="tripimpjdo"/>
    </extension>
    <extension vendor-name="kodo" key="jdbc-field-mappings">
    <extension vendor-name="kodo"
    key="trekwatch.core.TWObject.authorId">
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="value">
    <extension vendor-name="kodo" key="column"
    value="AUTHORID"/>
    </extension>
    </extension>
    <extension vendor-name="kodo"
    key="trekwatch.core.TWObject.id">
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="value">
    <extension vendor-name="kodo" key="column"
    value="ID"/>
    </extension>
    </extension>
    <extension vendor-name="kodo"
    key="trekwatch.core.TWObject.timeStamp">
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="value">
    <extension vendor-name="kodo" key="column"
    value="TIMESTAMP0"/>
    </extension>
    </extension>
    <extension vendor-name="kodo"
    key="trekwatch.core.security.AbstractPolicedObject.copyPolicy">
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="pc">
    <extension vendor-name="kodo" key="column"
    value="COPYPOLICY"/>
    </extension>
    </extension>
    <extension vendor-name="kodo"
    key="trekwatch.core.security.AbstractSecureTWObject.acl">
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="pc">
    <extension vendor-name="kodo" key="column"
    value="ACL"/>
    </extension>
    </extension>
    </extension>
    <extension vendor-name="kodo" key="jdbc-version-ind"
    value="version-number">
    <extension vendor-name="kodo" key="column"
    value="JDOVERSION"/>
    </extension>
    <field name="activities">
    <collection
    element-type="trekwatch.core.activity.ActivityImpJdo"/>
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="many-many">
    <extension vendor-name="kodo" key="element-column.ID"
    value="ACTIVITIES_ID"/>
    <extension vendor-name="kodo" key="order-column"
    value="ACTIVITIES_ORDER"/>
    <extension vendor-name="kodo" key="ref-column.ID"
    value="ID"/>
    <extension vendor-name="kodo" key="table"
    value="tripi_activities"/>
    </extension>
    </field>
    <field name="atomSignature" persistence-modifier="persistent">
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="pc">
    <extension vendor-name="kodo" key="column"
    value="ATOMSIGNATURE"/>
    </extension>
    </field>
    <field name="budget">
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="value">
    <extension vendor-name="kodo" key="column"
    value="BUDGET"/>
    </extension>
    </field>
    <field name="budgetType">
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="value">
    <extension vendor-name="kodo" key="column"
    value="BUDGETTYPE"/>
    </extension>
    </field>
    <field name="description">
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="value">
    <extension vendor-name="kodo" key="column"
    value="DESCRIPTION"/>
    </extension>
    </field>
    <field name="endDate">
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="value">
    <extension vendor-name="kodo" key="column"
    value="ENDDATE"/>
    </extension>
    </field>
    <field name="gearList">
    <extension vendor-name="kodo" key="jdbc-delete-action"
    value="null"/>
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="one-one">
    <extension vendor-name="kodo" key="column.ID"
    value="GEARLIST_ID"/>
    </extension>
    </field>
    <field name="name">
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="value">
    <extension vendor-name="kodo" key="column"
    value="NAME0"/>
    </extension>
    </field>
    <field name="numDays">
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="value">
    <extension vendor-name="kodo" key="column"
    value="NUMDAYS"/>
    </extension>
    </field>
    <field name="startDate">
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="value">
    <extension vendor-name="kodo" key="column"
    value="STARTDATE"/>
    </extension>
    </field>
    <field name="timeAvailable">
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="value">
    <extension vendor-name="kodo" key="column"
    value="TIMEAVAILABLE"/>
    </extension>
    </field>
    <field name="todoList">
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="one-one">
    <extension vendor-name="kodo" key="column.ID"
    value="TODOLIST_ID"/>
    </extension>
    </field>
    <field name="tripElements">
    <collection element-type="TripElement"/>
    <extension vendor-name="kodo" key="jdbc-field-map"
    value="pc-collection">
    <extension vendor-name="kodo" key="element-column"
    value="ELEMENT"/>
    <extension vendor-name="kodo" key="order-column"
    value="TRIPELEMENTS_ORDER"/>
    <extension vendor-name="kodo" key="ref-column.ID"
    value="ID"/>
    <extension vendor-name="kodo" key="table"
    value="tripi_tripelements"/>
    </extension>
    </field>
    </class>
    <table name="tripimpjdo">
    <pk column="ID"/>
    <column name="ACL" type="varchar" size="255"/>
    <column name="ATOMSIGNATURE" type="varchar" size="255"/>
    <column name="AUTHORID" type="varchar" size="255"/>
    <column name="BUDGET" type="integer"/>
    <column name="BUDGETTYPE" type="integer"/>
    <column name="COPYPOLICY" type="varchar" size="255"/>
    <column name="DESCRIPTION" type="varchar" size="255"/>
    <column name="ENDDATE" type="timestamp"/>
    <column name="GEARLIST_ID" type="bigint"/>
    <column name="ID" type="bigint" not-null="true"/>
    <column name="JDOCLASS" type="varchar" size="255"/>
    <column name="JDOVERSION" type="integer"/>
    <column name="NAME0" type="varchar" size="255"/>
    <column name="NUMDAYS" type="integer"/>
    <column name="STARTDATE" type="timestamp"/>
    <column name="TIMEAVAILABLE" type="integer"/>
    <column name="TIMESTAMP0" type="timestamp"/>
    <column name="TODOLIST_ID" type="bigint"/>
    <fk delete-action="cascade" to-table="gearitemlist"
    column="GEARLIST_ID"/>
    <fk to-table="todolist" column="TODOLIST_ID"/>
    <index name="I_TRPMPJD_GEARLIST_ID" column="GEARLIST_ID"/>
    <index name="I_TRPMPJD_JDOCLASS" column="JDOCLASS"/>
    <index name="I_TRPMPJD_JDOVERSION" column="JDOVERSION"/>
    <index name="I_TRPMPJD_TODOLIST_ID" column="TODOLIST_ID"/>
    </table>
    create-schema:
    [echo]
    ================================================================
    [echo] Refreshing the schema in the data store
    [echo]
    ================================================================
    [mappingtool] 625 INFO [main] kodo.Tool - Mapping tool running on type
    "class ***" with action "refresh".
    [mappingtool] 1891 INFO [main] kodo.Tool - Mapping tool running on type
    "class ***" with action "refresh".
    [mappingtool] 1906 INFO [main] kodo.Tool - Mapping tool running on type
    "class ***" with action "refresh".
    (many more of the same as above for each persistent class.
    [mappingtool] 2250 INFO [main] kodo.Tool - Recording mapping and schema
    changes.
    [mappingtool] 5063 WARN [main] kodo.jdbc.Schema - The foreign key
    "F_TRPMPJD_GEARLIST" was not added to table "TRIPIMPJDO".
    build:
    BUILD SUCCESSFUL
    Total time: 20 seconds
    Marc Prud'hommeaux wrote:
    Goerge-
    As well as adding the jdbc-delete-action, you also want to set the
    following in your kodo.properties:
    kodo.jdbc.ForeignKeyConstraints: true
    Also, I notice you are using MySQL: MySQL doesn't support some foreign
    keys (such as deferred constraints). Is your foreign key deferred? Can
    you post the schema.xml file, as well as the complete output from the
    mappingtool so we can take a look at it?
    In article <[email protected]>, Goerge wrote:
    UPDATE again:
    This dialog with myself is actually not bad.
    Anyway, I've made some head way:
    After reading through 16 pages of posts here, I found one with the same
    problem I had, where it stated that foreign key constraints are not added
    to the database unless a jdbc-delete-action extension is used.
    After adding the following extension to the field in question, I still do
    not get the foreign key in the database, but at least I get the following
    message when running the mapping tool:
    [mappingtool] 6157 WARN [main] kodo.jdbc.Schema - The foreign key
    "F_TRPMPJD_GEARLIST" was not added to table "TRIPIMPJDO".
    I am using MySQL with innodb tables, so foreign keys should be supported.
    Is there another reason they are not being added?
    Thanks again.
    Marc Prud'hommeaux
    SolarMetric Inc.

  • How to declare Compound Foreign Key for CMR

    Hi All,
    I would like to know, is it possible to declare CMR field for Compound Foreign key.
    Any Pointers would be appreicated.
    Thanks
    Ann.

    Compound foreign keys are declared (when the relationships are used) in the sun-cmp-mappings.xml file, like this:
          <cmr-field-mapping>
            <cmr-field-name>actividadePeriodos</cmr-field-name>
            <column-pair>
              <column-name>ACTIVIDADE.COD_PROJECTO</column-name>
              <column-name>ACTIVIDADE_PERIODO.COD_PROJECTO</column-name>
            </column-pair>
            <column-pair>
              <column-name>ACTIVIDADE.COD_ACTIVIDADE</column-name>
              <column-name>ACTIVIDADE_PERIODO.COD_ACTIVIDADE</column-name>
            </column-pair>
            <fetched-with>
              <none/>
            </fetched-with>
          </cmr-field-mapping>The declaration is done in the parent of the relationship. The other configurations (in sun-cmp-mappings, ejb-jar and the entity code) are just the same as for simple foreign keys.
    If the existing database relationships are not used in the app server (if there is no need for composite containment between the parent and the child), then the foreign keys don't need to be declared.

  • 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.

  • Mapping in OWB with primary key and foreign key relationship

    Hi all,
    I am new to this datawarehousing field. I have just started my career. I have to now create a mapping in owb where a table has a field which is a primary key of another table in the same staging area. If you guys could help me out with the a method it can be created that would be very helpful to me.
    I thought of 2 ideas,
    1. If I can use a look up, but then I am not sure if i can use a lookup for primary key, foreign key relationship. If I can use also, I do not know how to use that.
    2. What if I can directly take that the first table and link the primary key of that table to the second table which uses that primary key of the first table as one of its fields.
    I do not know how feasible these methods are. Please guys help me out.
    Thanks in advance.

    I have a similar case where table a and table b having relation but table a got inserted with data and table b is empty so there no values for foriegn key column in table b to realte with table a.
    Now i want to load table b foriegn key with primary key column values of table a.
    how can we do this in owb
    thanks
    kumar

  • Mapping problem with compressed key update record

    Hi, could you please advise?
    I'm getting the following problem:
    About a week ago replicat abened with "Error in mapping" error. I found in discard file some record looking like:
    filed1 = NULL
    field2 =
    field3 =
    field4 =
    field5 =
    datefield = -04-09 00:00:00
    field6 =
    field8 =
    field9 = NULL
    field10 =
    Where filed9 = @GETENV("GGHEADER", "COMMITTIMESTAM"), field10 = = @GETENV("GGHEADER", "COMMITTIMESTAM"), others are table fields mapped by USEDEFAULTS
    So I got Mapping problem with compressed key update record at 2012-06-01 15:44
    I guess I need to mention that extract failed in 5 minuts before it with: VAM function VAMRead returned unexpected result: error 600 - VAM Client Report <[CFileInfo::Read] Timeout expired after 10 retries with 1000 ms delay, waiting to read transaction log or backup files. To increase the number of retries, use SETENV (GGS_CacheRetryCount = n) in Extract parameter file. To control retry delay time, use SETENV (GGS_CacheRetryDelay = n). handle: 0000000000000398 ReadFile GetLastError:997 Wait GetLastError:997>.
    I don't know if it has ther same source as data corruption, could you tell me if it is?
    Well, I created new extract, starting 2012-06-01 15:30 to check if there was something with extract at the time, but got the same error.
    If I run extract beging at 15:52 it starts and works.
    But well, I got another one today. Data didn't look that bad, but yet one column came with null value:( And I'm using it as a key column, so I got Mapping problem with compressed key update record again:(
    I'm replicating from SQL Server 2008 to Oracle 11g.
    I'm actually using NOCOMPRESSUPDATES in Extract.
    CDC is enabled for all tables replicated. The only thing is that it is enabled not by ADD TRANDATA command, but by SQL Server sys.sp_cdc_enable_table, does it matter?
    Could you please advise why does it happen?

    Well, the problem begins somewhere in extract or before extract, may be in transaction log, I don't know:(
    Here are extract parameters:
    EXTRACT ETCHECK
    TRANLOGOPTIONS MANAGESECONDARYTRUNCATIONPOINT
    SOURCEDB TEST, USERID **, PASSWORD *****
    exttrail ./dirdat/ec
    NOCOMPRESSUPDATES
    NOCOMPRESSDELETES
    TABLE tst.table1, COLS (field1, field2, field3, field4, field5, field6, field7, field8 );
    TABLE tst.table2, COLS (field1, field2, field3, field4 );
    Data pump:
    EXTRACT DTCHECK
    SOURCEDB TEST, USERID **, PASSWORD *****
    RMTHOST ***, MGRPORT 7809
    RMTTRAIL ./dirdat/dc
    TABLE tst.table1;
    TABLE tst.table2;
    Replicat:
    REPLICAT rtcheck
    USERID tst, PASSWORD ***
    DISCARDFILE ./dirrpt/rtcheck.txt, PURGE
    SOURCEDEFS ./dirdef/sourcei.def
    HANDLECOLLISIONS
    UPDATEDELETES
    MAP tst.table1, t.table1, COLMAP (USEDEFAULTS , filed9 = @GETENV("GGHEADER", "COMMITTIMESTAMP"), filed10= @CASE(@GETENV("GGHEADER", "OPTYPE"), "SQL COMPUPDATE", "U", "PK UPDATE", "U",@GETENV("GGHEADER", "OPTYPE")) ), KEYCOLS (field3);
    MAP dbo.TPROCPERIODCONFIRMSTAV, TARGET R_019_000001.TPROCPERIODCONFIRMSTAV, COLMAP (USEDEFAULTS , field5 = @GETENV("GGHEADER", "COMMITTIMESTAMP"), filed6= @CASE(@GETENV("GGHEADER", "OPTYPE"), "SQL COMPUPDATE", "U", "PK UPDATE", "U",@GETENV("GGHEADER", "OPTYPE")) ), KEYCOLS (filed1, field2, field3);
    Rpt file for replicat:
    Oracle GoldenGate Delivery for Oracle
    Version 11.1.1.1 OGGCORE_11.1.1_PLATFORMS_110421.2040
    Windows x64 (optimized), Oracle 11g on Apr 22 2011 00:34:07
    Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
    Starting at 2012-06-05 12:49:38
    Operating System Version:
    Microsoft Windows Server 2008 R2 , on x64
    Version 6.1 (Build 7601: Service Pack 1)
    Process id: 2264
    Description:
    ** Running with the following parameters **
    REPLICAT rtcheck
    USERID tst, PASSWORD ***
    DISCARDFILE ./dirrpt/rtcheck.txt, PURGE
    SOURCEDEFS ./dirdef/sourcei.def
    HANDLECOLLISIONS
    UPDATEDELETES
    MAP tst.table1, t.table1, COLMAP (USEDEFAULTS , filed9 = @GETENV("GGHEADER", "COMMITTIMESTAMP"), filed10= @CASE(@GETENV("GGHEADER", "OPTYPE"), "SQL COMPUPDATE", "U", "PK UPDATE", "U",@GETENV("GGHEADER", "OPTYPE")) ), KEYCOLS (field3);
    MAP dbo.TPROCPERIODCONFIRMSTAV, TARGET R_019_000001.TPROCPERIODCONFIRMSTAV, COLMAP (USEDEFAULTS , field5 = @GETENV("GGHEADER", "COMMITTIMESTAMP"), filed6= @CASE(@GETENV("GGHEADER", "OPTYPE"), "SQL COMPUPDATE", "U", "PK UPDATE", "U",@GETENV("GGHEADER", "OPTYPE")) ), KEYCOLS (filed1, field2, field3);
    CACHEMGR virtual memory values (may have been adjusted)
    CACHEBUFFERSIZE: 64K
    CACHESIZE: 512M
    CACHEBUFFERSIZE (soft max): 4M
    CACHEPAGEOUTSIZE (normal): 4M
    PROCESS VM AVAIL FROM OS (min): 1G
    CACHESIZEMAX (strict force to disk): 881M
    Database Version:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE     11.2.0.1.0     Production
    TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    Database Language and Character Set:
    NLS_LANG = "AMERICAN_AMERICA.CL8MSWIN1251"
    NLS_LANGUAGE = "AMERICAN"
    NLS_TERRITORY = "AMERICA"
    NLS_CHARACTERSET = "CL8MSWIN1251"
    For further information on character set settings, please refer to user manual.
    ** Run Time Messages **
    Opened trail file ./dirdat/dc000000 at 2012-06-05 12:49:39
    2012-06-05 12:58:14 INFO OGG-01020 Processed extract process RESTART_ABEND record at seq 0, rba 925 (aborted 0 records).
    MAP resolved (entry tst.table1):
    MAP tst.table1, t.table1, COLMAP (USEDEFAULTS , filed9 = @GETENV("GGHEADER", "COMMITTIMESTAMP"), filed10= @CASE(@GETENV("GGHEADER", "OPTYPE"), "SQL COMPUPDATE", "U", "PK UPDATE", "U",@GETENV("GGHEADER", "OPTYPE")) ), KEYCOLS (field3);
    2012-06-05 12:58:14 WARNING OGG-00869 No unique key is defined for table table1. All viable columns will be used to represent the key, but may not guarantee uniqueness. KEYCOLS may be used to define the key.
    Using the following default columns with matching names:
    field1=field1, field2=field2, field3=field3, field4=field4, field5=field5, field6=field6, field7=field7, field8=field8
    Using the following key columns for target table R_019_000001.TCALCULATE: field3.
    2012-06-05 12:58:14 WARNING OGG-01431 Aborted grouped transaction on 'tst.table1', Mapping error.
    2012-06-05 12:58:14 WARNING OGG-01003 Repositioning to rba 987 in seqno 0.
    2012-06-05 12:58:14 WARNING OGG-01151 Error mapping from tst.table1 to tst.table1.
    2012-06-05 12:58:14 WARNING OGG-01003 Repositioning to rba 987 in seqno 0.
    Source Context :
    SourceModule : [er.main]
    SourceID : [er/rep.c]
    SourceFunction : [take_rep_err_action]
    SourceLine : [16064]
    ThreadBacktrace : [8] elements
    : [C:\App\OGG\replicat.exe(ERCALLBACK+0x143034) [0x00000001402192B4]]
    : [C:\App\OGG\replicat.exe(ERCALLBACK+0x11dd44) [0x00000001401F3FC4]]
    : [C:\App\OGG\replicat.exe(<RCALLBACK+0x11dd44) [0x000000014009F102]]
    : [C:\App\OGG\replicat.exe(<RCALLBACK+0x11dd44) [0x00000001400B29CC]]
    : [C:\App\OGG\replicat.exe(<RCALLBACK+0x11dd44) [0x00000001400B8887]]
    : [C:\App\OGG\replicat.exe(releaseCProcessManagerInstance+0x25250) [0x000000014028F200]]
    : [C:\Windows\system32\kernel32.dll(BaseThreadInitThunk+0xd) [0x000000007720652D]]
    : [C:\Windows\SYSTEM32\ntdll.dll(RtlUserThreadStart+0x21) [0x000000007733C521]]
    2012-06-05 12:58:14 ERROR OGG-01296 Error mapping from tst.table1 to tst.table1.
    * ** Run Time Statistics ** *
    Last record for the last committed transaction is the following:
    Trail name : ./dirdat/dc000000
    Hdr-Ind : E (x45) Partition : . (x04)
    UndoFlag : . (x00) BeforeAfter: A (x41)
    RecLength : 249 (x00f9) IO Time : 2012-06-01 15:48:56.285333
    IOType : 115 (x73) OrigNode : 255 (xff)
    TransInd : . (x03) FormatType : R (x52)
    SyskeyLen : 0 (x00) Incomplete : . (x00)
    AuditRBA : 44 AuditPos : 71176199289771
    Continued : N (x00) RecCount : 1 (x01)
    2012-06-01 15:48:56.285333 GGSKeyFieldComp Len 249 RBA 987
    Name: DBO.TCALCULATE
    Reading ./dirdat/dc000000, current RBA 987, 0 records
    Report at 2012-06-05 12:58:14 (activity since 2012-06-05 12:58:14)
    From Table tst.table1 to tst.table1:
    # inserts: 0
    # updates: 0
    # deletes: 0
    # discards: 1
    Last log location read:
    FILE: ./dirdat/dc000000
    SEQNO: 0
    RBA: 987
    TIMESTAMP: 2012-06-01 15:48:56.285333
    EOF: NO
    READERR: 0
    2012-06-05 12:58:14 ERROR OGG-01668 PROCESS ABENDING.
    Discard file:
    Oracle GoldenGate Delivery for Oracle process started, group RTCHECK discard file opened: 2012-06-05 12:49:39
    Key column filed3 (0) is missing from update on table tst.table1
    Missing 1 key columns in update for table tst.table1.
    Current time: 2012-06-05 12:58:14
    Discarded record from action ABEND on error 0
    Aborting transaction on ./dirdat/dc beginning at seqno 0 rba 987
    error at seqno 0 rba 987
    Problem replicating tst.table1 to tst.table1
    Mapping problem with compressed key update record (target format)...
    filed1 = NULL
    field2 =
    field3 =
    field4 =
    field5 =
    datefield = -04-09 00:00:00
    field6 =
    field8 =
    field9 = NULL
    field10 =
    Process Abending : 2012-06-05 12:58:14

  • 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 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

Maybe you are looking for

  • Using a import statement conditionally

    How would I import a library statement based on a condition, in this example use the versioning of java JRE that the program needs is to run under the JRE? i.e: import javax.swing.*; //This is the final package name. //import com.sun.java.swing.*; //

  • Cannot View certain reports in Discoverer Viewer

    Hi All, The administrator account can view all reports. However, users cannot access certain reports. 1. All reports have been shared by users 2. Users have access to business areas 3. Fan traps is disabled 4.. users have following privileges: a. Col

  • Postfix Imap problem

    I am using Postfix 2.5.5 running on a Mac Pro (Snow Leopard) as a mail server for my very small home network. I use Apple Mail on both the Mac Pro and on an old Powerbook (Leopard) to access my mailbox via Imap. This used to work just fine but in rec

  • Calendar upgrade 6.3 to 7

    Hi guys, I have Calendar Server 6.3 installed as part of the Sun Comm-Suite-6 update 2 do you know if I can upgrade only the calendar server from 6.3 to 7 without upgrading the other components like (app server, directory server, Convergence etc...)

  • How to Watching AVI on QuickTime

    I have an Pentax Optio S5z. It makes AVI movie files. On my old computer (cube) my friend installed something that allowed me to see those files easily with QuickTime. I didn't have to convert them to anything, just click on them and they open up per