LSMW - 1 to many mapping ?

I want to create an LSMW mapping where my data file will contain a legacy equipment # that could create 1-many equipments in SAP. how can I do a 1 - many mapping? Whre do I handle that in LSMW workbench?

I'm not 100% I understand your question.
I'm pretty sure I've seen something similar done before with IDOCs. Basically we wanted to bundle all the same MARC segments for the same material into a single IDOC. You basically define two files, one with the complete data and a second with a list of unique material numbers. Then you map the second file to the header record and the first file to the detail records in the IDOC.
Otherwise, well it depends on how you are trying to load the load in. If it's by IDOC, then it's just an extra segment.

Similar Messages

  • One to many mapping

    Having trouble with the following poblem.. specially how to code getChildren??????? Help urgent
    Create a class called Families which creates a one-to-many mapping of parent name (String) to Child objects. Create any needed member variables and write the two specified methods. (You do not need to write the Child class.)
    class Families {
    public void addToFamily( String parent, Child child) {
    public List getChildren( String parent) {
    I have done the following..
    import java.util.ArrayList;
    import java.util.List;
    class Families {
    private String parentName;
    List <child> children = new ArrayList();
    public Families(String name){
    this.parentName = name;
    public void addToFamily( String parent, child kid) {
    Families f = new Families(parent);
         f.children.add(kid);      
    public List<child> getChildren( String parent) {
         return this.children;
    }

    Having trouble with the following poblem.. specially
    how to code getChildren??????? Help urgent
    Create a class called Families which creates a
    one-to-many mapping of parent name (String) to Child
    objects. Create any needed member variables and write
    the two specified methods. This key:
    (You do not need to write the Child class.)How can the following line possibly work?
    List <child> children = new ArrayList();It's not syntactically correct, AND you're not writing the Child class.
    %

  • Many-to-many mapping question

    Hi,
    I'm working with two classes Car and Customer. The Car class has a Vector of Customers and the Customer class has a Vector of Car. Both are related by a many to many mapping.
    I have noticed that I have to set one of the vector to read only to avoid the error message "More than one writable many-to-many mapping can not use the same relation table" in the mapping workbench.
    I can understand that but is there a way to work around, I mean to be able to add a car to a customer and add a customer to a car with the both vectors?
    Is there something to do with the cache?
    I use Vector for the collection or Map class, have I to do otherwise?

    Hello Vladislav, I understand your first question in this thread, but I'm not sure I follow the rest, so let me respond to your first post:
    "I have noticed that I have to set one of the vector to read only to avoid the error message "More than one writable many-to-many mapping can not use the same relation table" in the mapping workbench.
    I can understand that but is there a way to work around, I mean to be able to add a car to a customer and add a customer to a car with the both vectors?"
    The issue here is that with a Many to Many mapping the mapping is responsible for writing to the association table. So, you have a "CAR_CUST" association table. Imagine you add a Car "101" to a customer "501" and the requisite customer "501" to that car "101" in your object model. Then the association table should only be updated once, with an entry of "101, 501". But since the M-M is mapped in both directions, you need to tell TopLink which of these to consider as the "master" when updating the database.
    If you didn't make one of the M-M mappings "read only", then TopLink would insert "101, 501" twice in the association table, and then at a later date you would see that the customer 501 had two 101 cars!
    We do have a feature that allows for TopLink to maintain bidirectional relationships such that if you add or remove a target from one relationship, TopLink will automatically add/remove it from the opposite direction. In my opinion this is lazy programming! A good Java developer should insist on keeping his model up to date on his own. This feature was added because it's part of the EJB spec, not necessarily because it's a good idea ;)
    - Don
    Is there something to do with the cache?
    I use Vector for the collection or Map class, have I to do otherwise?

  • Loading FLat file data using FDMEE having 1 to many mapping

    Hi All,
    I need to load a data from Flat file to hyperion planning applcation using FDMEE having one to many mapping
    For e.g Data file has 2 records
    Acc Actual Version1 Scene1 1000
    Acc Actual Version1 Scene2 2000
    now target application has 5 dimension and data need to be load as
    acc Actual Version1 entity1 Prod2 1000
    Acc Actual Version1 Entity2 Prod2 2000
    Please suggest
    Regards
    Anubhav

    From your exmple I don't see the one too many mapping requirement. You have one source data line that maps to a single target intersection. Where is the one to many mapping requirement in your example?

  • How can I filter to find photos NOT pinned to a map? I have 28,000 phots with many mapped and many not. The Search function does not include GPS data. I haven't found  way to search metadata inside or out of Elements.

    How can I filter to find photos NOT pinned to a map? I have 28,000 phots with many mapped and many not. The Search function does not include GPS data. I haven't found  way to search metadata inside or out of Elements.

    How can I filter to find photos NOT pinned to a map? I have 28,000 phots with many mapped and many not. The Search function does not include GPS data. I haven't found  way to search metadata inside or out of Elements.

  • Mapping issue, "many to many"  mapping

    Hi specialists!
    I have to map this structure:
    source
    segment_1   (1...n)
    key_1
    aaa
    bbb
    segment_2   (1...n)
    key_2
    ccc
    ddd
    Target:
    segment_2
    ccc
    ddd
    The condition is segment_1=>key1 = segment_2=>key2
    The problem is that I need to check each segment_1 with each segment_2.
    Is it possible using standard mapping functions?

    Dani_K,
    This can be done with standard mapping if your source.segment_1.key_1 is unique.   If it is not, you could end up with a many to many mapping which would be difficult no matter how you map. 
    Try this:
    For segment_2
    source.segment_1.key_1 (right click, context, source) ---> sort --->
    source.segment_2.key_2 (right click, context, source) ---> sort --->
    equalsS --->   ifWithoutElse --->
    source.segment_2  (then)               
    removeContexts  (after the If Then)--->   target.segment_2
    For ccc
    source.segment_1.key_1 (right click, context, source) ---> sort --->
    source.segment_2.key_2 (right click, context, source) ---> sort --->
    equalsS --->   ifWithoutElse --->
    source.segment_1.ccc  (right click, context, source)     (then)               
    removeContexts  (after the If Then)--->  SplitByValue(Each Value) ---> target.segment_2.ccc
    For ddd
    source.segment_1.key_1 (right click, context, source) ---> sort --->
    source.segment_2.key_2 (right click, context, source) ---> sort --->
    equalsS --->   ifWithoutElse --->
    source.segment_1.ddd (right click, context, source)     (then)               
    removeContexts  (after the If Then)--->   SplitByValue(Each Value) ---> target.segment_2.ddd
    Ideally, the segment_1.Key_1 and segment_2.key_2 are sorted before you process the message.  If so, remove the sort above.

  • Toplink - Many-to-Many Mapping issue

    Hi
    I have the following tables
    User
    Place
    Team
    User : uid , name (where uid is primay key)
    Place : uid , pid( where uid and pid are composite primary keys)
    Team : tid , name , pid( where tid is primary key)
    Here the following mappings :
    one user is belongs to many places
    one user have many teams( by place)
    user have many teams
    i have created many to many mapping between place(or user) and team tables using intermediate table user_team( uid ,tid). But when i try to retrieve the teams for user id then i m getting all the teams. Here i need to filter the teams by only place id instead getting all the teams.
    For example:
    if user id is belongs to place id 101 then i need to get only teams belongs to place id 101. But i m getting all the places(101,102) teams for same user id which belongs to place id 101.
    Please help me out how i can create valide mapping between all the tables to retrieve valid data. i m using toplink workbench(10g - 9.0.4).

    Your model seems confused, you may wish to re-think you model. It seems odd that a place would have a user id, seems more like it is a m-m join table between user and team, but then it should have a team id not a place id.
    You can use a selectionCriteria() on a ManyToManyMapping to define complicated m-m joins, but you would probably be better re-thinking your model. What object model are you trying to do exactly? Go from there, then define your data-model.
    -- James : http://www.eclipselink.org

  • OLAP issue with MANY TO MANY mapping

    Hi All,
    We have a requirement where we have to pull specific measures & associated dimensions data from an OLAP to SQL tables. The source cube has almost 80 % of MANY TO MANY mappings.
    When we pull this data to SQL tables either by writing MDX or DMX dimension level metric values are not matching with what OLAP browsing is providing.
    When we pull this measure with only regular dimensions metric values with all dimensions exactly match. The mismatch issue comes when we have at least 1 MANY TO MANY dimension part of MDX or DMX query. Further to this we have pulled all intermediate facts
    & dimensions involved in MANY TO MANY mapping into SQL tables & tried a number of JOINS but the metric values haven’t match up.
    We are very close on delivery dates & are not sure on any resolution. Could you please guide us on next steps here.
    Thanks is advance.

    Hi All,
    We have a requirement where we have to pull specific measures & associated dimensions data from an OLAP to SQL tables. The source cube has almost 80 % of MANY TO MANY mappings.
    When we pull this data to SQL tables either by writing MDX or DMX dimension level metric values are not matching with what OLAP browsing is providing.
    When we pull this measure with only regular dimensions metric values with all dimensions exactly match. The mismatch issue comes when we have at least 1 MANY TO MANY dimension part of MDX or DMX query. Further to this we have pulled all intermediate facts
    & dimensions involved in MANY TO MANY mapping into SQL tables & tried a number of JOINS but the metric values haven’t match up.
    We are very close on delivery dates & are not sure on any resolution. Could you please guide us on next steps here.
    Thanks is advance.

  • Take2 - Many-to-Many mapping on a single object/table via an external table.

    Plaease ignore the previous entry. Finger trouble on the keyboard
    accidentally posted prior to completion!
    Any takers on this one? If its simple, then great.
    I currently have a problem making the correct meta-data via xdoclet for a
    collection with a many-to-many mapping between an enhanced class and an
    xref table (which does not have an enhanced class associated with it.)
    Although page 184 of the Kodo JDO 3.01 Developers guide does spell out in
    fairly academic terms what has to be done, it still seems fairly
    impenetrable, after much mangling and hacking.
    As far as I can see the significantly questionable attributes are:-
    element-column.<pk column>*
    and
    ref-column.<pk column>*
    The asterisks and the associated texts indicate that these entries can be
    specified more than once.
    Here is my Meta data.
    * @jdo.field collection-type="collection"
    element-type="com.letsys.erespond.business.model.event.Condition"
    * @jdo.field-vendor-extension vendor-name="kodo" key="jdbc-field-map"
    value="many-many"
    * @jdo.field-vendor-extension vendor-name="kodo"
    key="jdbc-field-map/table" value="EventConditionConditionXref"
    * @jdo.field-vendor-extension vendor-name="kodo"
    key="jdbc-field-map/element-column.ID" value="EVENTCONDITIONID"
    * @jdo.field-vendor-extension vendor-name="kodo"
    key="jdbc-field-map/ref-column.EVENTCONDITIONID" value="ID"
    private Collection groupsToConditions;
    Here is the basic table which I wish to use for the xref
    create table EventConditionConditionXref(
    EventConditionId NUMBER(10) NOT NULL primary key,
    EventConditionIdGroupTo NUMBER(10) NOT NULL primary key
    The EventCondition class and table uses a field 'id' as its primary key.
    The intention is the xref table will hold many-many associations between
    multiple EventCondition.id instances in the underlying database.
    Thus the joing condition would be :
    select
    EventConditionIdGroupTo
    from
    EventCondition ec, EventConditionConditionXref ecx
    where
    ec.id = ecx.EventConditionId
    There are numerous variations that I have squeezed through it, but the net
    effect has always been
    BUILD FAILED
    file:C:/dev/projectm/build.xml:303:
    kodo.jdbc.meta.MappingInfoNotFoundException: The mapping for fie
    ld "com.letsys.erespond.business.model.event.Condition.groupsToConditions"
    is missing information on
    how to link the fields table to its owning class table, or the given
    information is invalid.
    I have tried many interpretations as to how
    element-column.<pk column>*
    and
    ref-column.<pk column>*
    should be represented, but always with the same 'not enough info' message.
    Am I missing something obvious, and/or not understanding something?
    Cheers Ed.

    Ed-
    I think what you want is:
    @jdo.field collection-type="collection"
    element-type="com.letsys.erespond.business.model.event.Condition"
    @jdo.field-vendor-extension vendor-name="kodo" key="jdbc-field-map"
    value="many-many"
    @jdo.field-vendor-extension vendor-name="kodo"
    key="jdbc-field-map/table" value="EventConditionConditionXref"
    @jdo.field-vendor-extension vendor-name="kodo"
    key="jdbc-field-map/ref-column.ID" value="EVENTCONDITIONID"
    @jdo.field-vendor-extension vendor-name="kodo"
    key="jdbc-field-map/element-column.ID" value="EVENTCONDITIONIDGROUPTO"
    Basically, the "ref-column.<primary key>" specifies the column in the
    join table that holds the primary key of the source side of the relation
    (the current class), and the "element-column.<primary key>" specifies
    the column in the join table that holds the primary key of the
    destination side of the relation (the content of the Collection field).
    Since it appears that you want the relation to be from Condition to
    Condition (i.e., have a relation it itself), the primary key in both
    cases will be the 'ID' column.
    Let us know if you still have problems with this. You might want to
    check out our graphical mapping workbench in 3.1, which helps greatly
    simplify composing your mappings.
    In article <[email protected]>, Ed Bett wrote:
    Plaease ignore the previous entry. Finger trouble on the keyboard
    accidentally posted prior to completion!
    Any takers on this one? If its simple, then great.
    I currently have a problem making the correct meta-data via xdoclet for a
    collection with a many-to-many mapping between an enhanced class and an
    xref table (which does not have an enhanced class associated with it.)
    Although page 184 of the Kodo JDO 3.01 Developers guide does spell out in
    fairly academic terms what has to be done, it still seems fairly
    impenetrable, after much mangling and hacking.
    As far as I can see the significantly questionable attributes are:-
    element-column.<pk column>*
    and
    ref-column.<pk column>*
    The asterisks and the associated texts indicate that these entries can be
    specified more than once.
    Here is my Meta data.
    * @jdo.field collection-type="collection"
    element-type="com.letsys.erespond.business.model.event.Condition"
    * @jdo.field-vendor-extension vendor-name="kodo" key="jdbc-field-map"
    value="many-many"
    * @jdo.field-vendor-extension vendor-name="kodo"
    key="jdbc-field-map/table" value="EventConditionConditionXref"
    * @jdo.field-vendor-extension vendor-name="kodo"
    key="jdbc-field-map/element-column.ID" value="EVENTCONDITIONID"
    * @jdo.field-vendor-extension vendor-name="kodo"
    key="jdbc-field-map/ref-column.EVENTCONDITIONID" value="ID"
    private Collection groupsToConditions;
    Here is the basic table which I wish to use for the xref
    create table EventConditionConditionXref(
    EventConditionId NUMBER(10) NOT NULL primary key,
    EventConditionIdGroupTo NUMBER(10) NOT NULL primary key
    The EventCondition class and table uses a field 'id' as its primary key.
    The intention is the xref table will hold many-many associations between
    multiple EventCondition.id instances in the underlying database.
    Thus the joing condition would be :
    select
    EventConditionIdGroupTo
    from
    EventCondition ec, EventConditionConditionXref ecx
    where
    ec.id = ecx.EventConditionId
    There are numerous variations that I have squeezed through it, but the net
    effect has always been
    BUILD FAILED
    file:C:/dev/projectm/build.xml:303:
    kodo.jdbc.meta.MappingInfoNotFoundException: The mapping for fie
    ld "com.letsys.erespond.business.model.event.Condition.groupsToConditions"
    is missing information on
    how to link the fields table to its owning class table, or the given
    information is invalid.
    I have tried many interpretations as to how
    element-column.<pk column>*
    and
    ref-column.<pk column>*
    should be represented, but always with the same 'not enough info' message.
    Am I missing something obvious, and/or not understanding something?
    Cheers Ed.
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • MappingInfoNotFoundException with one-many mapping to horizontal PC subclass

    Hi,
    I have a nasty niggling problem with a one-many mapping where the many
    side is a horizontally-mapped persistent subclass:
    kodo.util.FatalUserException: kodo.jdbc.meta.MappingInfoNotFoundException:
    The reference mappings for one-to-many field "Invoice.openTrades" are not
    in the table of the field's related persistent element
    type.[Invoice.openTrades [kodo.jdbc.meta.OneToManyFieldMapping]]
         at
    kodo.runtime.PersistenceManagerImpl.attach(PersistenceManagerImpl.java:4363)...
    NestedThrowablesStackTrace:
    kodo.jdbc.meta.MappingInfoNotFoundException: The reference mappings for
    one-to-many field "Invoice.openTrades" are not in the table of the field's
    related persistent element type.[Invoice.openTrades
    [kodo.jdbc.meta.OneToManyFieldMapping]]
         at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:134)
         at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:120)
         at
    kodo.jdbc.meta.OneToManyFieldMapping.fromMappingInfo(OneToManyFieldMapping.java:94)
         at
    kodo.jdbc.meta.RuntimeMappingProvider.getFieldMapping(RuntimeMappingProvider.java:198)
         at
    kodo.jdbc.meta.MappingRepository.getFieldMapping(MappingRepository.java:470)
         at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.java:991)
         at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.java:971)
         at
    kodo.jdbc.meta.AbstractClassMapping.getMappings(AbstractClassMapping.java:934)
         at
    kodo.jdbc.meta.AbstractClassMapping.getDeclaredFieldMappings(AbstractClassMapping.java:654)
         at
    kodo.jdbc.meta.AbstractClassMapping.resolve(AbstractClassMapping.java:796)
         at kodo.jdbc.meta.MappingRepository.resolve(MappingRepository.java:431)
         at kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:349)
         at kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:177)
         at
    kodo.jdbc.meta.MappingRepository.getMetaData(MappingRepository.java:165)
         at
    kodo.runtime.PersistenceManagerImpl.makePersistent(PersistenceManagerImpl.java:2423)
         at
    kodo.runtime.PersistenceManagerImpl.makePersistent(PersistenceManagerImpl.java:2375)
         at kodo.runtime.AttachManager.makePersistent(AttachManager.java:410)
         at kodo.runtime.AttachManager.attach(AttachManager.java:279)
         at kodo.runtime.AttachManager.attach(AttachManager.java:56)
         at
    kodo.runtime.PersistenceManagerImpl.attach(PersistenceManagerImpl.java:4349)
    I have another one-many mapping on the "one" class which is fine and is
    almost identical to the invalid mapping - it joins on the same
    columns/foreign key. The only real difference is that my invalid "many"
    side is a horizontally mapped subclass (parent class mapped to different
    table). When I took that class out of its hierarchy and mapped it as base,
    it works. I don't know why Kodo is saying the mapping for the join is not
    found, as the "many" side has an invoice field mapped as one-one. The
    superclass does not have a relation to invoice mapped. A slight
    complication is that Invoice itself has a persistent superclass persisted
    in the same table, but nothing refers to that so I don't think it is
    relevant.
    Class diagram is roughly like this:
    BaseTrade
    |
    Invoice 1-* Trade
    BaseReceipt
    |
    Invoice 1-* Receipt
    Invoice mapped to Invoice table; Trade mapped to Trade table but its
    superclass mapped to diff BaseTrade table; Receipt and its superclass
    BaseReceipt mapped to Receipt table.
    I saw an earlier posting on the same exception that mentioned "collection
    element-type" - mine is specified as "Trade", ie the subclass.
    Is there any reason why this should not work?
    I can provide you with .jdo and .mapping files if necessary.
    Many thanks,
    Alex

    Alex-
    Can you post your mapping? I just ran a test with a one-many relation to
    a subclass of a horizontally mapped class, and it worked fine.
    FYI, the example mapping I was using was:
    <?xml version="1.0" encoding="UTF-8"?>
    <mapping>
    <package name="horizmany">
    <class name="HorizManyOwner">
    <jdbc-class-map type="base" pk-column="JDOID"
    table="BUG1174OWNER"/>
    <jdbc-version-ind type="version-number"
    column="JDOVERSION"/>
    <jdbc-class-ind type="in-class-name" column="JDOCLASS"/>
    <field name="relation">
    <jdbc-field-map type="one-many"
    ref-column.JDOID="OWNER_JDOID" table="BUG1174RELATIONSUB"/>
    </field>
    </class>
    <class name="HorizManyRelationSub">
    <jdbc-class-map type="base" pk-column="JDOID"
    table="BUG1174RELATIONSUB"/>
    <jdbc-version-ind type="version-number"
    column="JDOVERSION"/>
    <jdbc-class-ind type="in-class-name" column="JDOCLASS"/>
    <field name="horizmany.HorizManyRelationSuper.superString">
    <jdbc-field-map type="value" column="SUPERSTRING"/>
    </field>
    <field name="owner">
    <jdbc-field-map type="one-one"
    column.JDOID="OWNER_JDOID"/>
    </field>
    <field name="subString">
    <jdbc-field-map type="value" column="SUBSTRING0"/>
    </field>
    </class>
    <class name="HorizManyRelationSuper">
    <jdbc-class-map type="horizontal"/>
    </class>
    </package>
    </mapping>
    In article <[email protected]>, Alex Robbins wrote:
    Hi,
    I have a nasty niggling problem with a one-many mapping where the many
    side is a horizontally-mapped persistent subclass:
    kodo.util.FatalUserException: kodo.jdbc.meta.MappingInfoNotFoundException:
    The reference mappings for one-to-many field "Invoice.openTrades" are not
    in the table of the field's related persistent element
    type.[Invoice.openTrades [kodo.jdbc.meta.OneToManyFieldMapping]]
         at
    kodo.runtime.PersistenceManagerImpl.attach(PersistenceManagerImpl.java:4363)...
    NestedThrowablesStackTrace:
    kodo.jdbc.meta.MappingInfoNotFoundException: The reference mappings for
    one-to-many field "Invoice.openTrades" are not in the table of the field's
    related persistent element type.[Invoice.openTrades
    [kodo.jdbc.meta.OneToManyFieldMapping]]
         at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:134)
         at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:120)
         at
    kodo.jdbc.meta.OneToManyFieldMapping.fromMappingInfo(OneToManyFieldMapping.java:94)
         at
    kodo.jdbc.meta.RuntimeMappingProvider.getFieldMapping(RuntimeMappingProvider.java:198)
         at
    kodo.jdbc.meta.MappingRepository.getFieldMapping(MappingRepository.java:470)
         at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.java:991)
         at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.java:971)
         at
    kodo.jdbc.meta.AbstractClassMapping.getMappings(AbstractClassMapping.java:934)
         at
    kodo.jdbc.meta.AbstractClassMapping.getDeclaredFieldMappings(AbstractClassMapping.java:654)
         at
    kodo.jdbc.meta.AbstractClassMapping.resolve(AbstractClassMapping.java:796)
         at kodo.jdbc.meta.MappingRepository.resolve(MappingRepository.java:431)
         at kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:349)
         at kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:177)
         at
    kodo.jdbc.meta.MappingRepository.getMetaData(MappingRepository.java:165)
         at
    kodo.runtime.PersistenceManagerImpl.makePersistent(PersistenceManagerImpl.java:2423)
         at
    kodo.runtime.PersistenceManagerImpl.makePersistent(PersistenceManagerImpl.java:2375)
         at kodo.runtime.AttachManager.makePersistent(AttachManager.java:410)
         at kodo.runtime.AttachManager.attach(AttachManager.java:279)
         at kodo.runtime.AttachManager.attach(AttachManager.java:56)
         at
    kodo.runtime.PersistenceManagerImpl.attach(PersistenceManagerImpl.java:4349)
    I have another one-many mapping on the "one" class which is fine and is
    almost identical to the invalid mapping - it joins on the same
    columns/foreign key. The only real difference is that my invalid "many"
    side is a horizontally mapped subclass (parent class mapped to different
    table). When I took that class out of its hierarchy and mapped it as base,
    it works. I don't know why Kodo is saying the mapping for the join is not
    found, as the "many" side has an invoice field mapped as one-one. The
    superclass does not have a relation to invoice mapped. A slight
    complication is that Invoice itself has a persistent superclass persisted
    in the same table, but nothing refers to that so I don't think it is
    relevant.
    Class diagram is roughly like this:
    BaseTrade
    |
    Invoice 1-* Trade
    BaseReceipt
    |
    Invoice 1-* Receipt
    Invoice mapped to Invoice table; Trade mapped to Trade table but its
    superclass mapped to diff BaseTrade table; Receipt and its superclass
    BaseReceipt mapped to Receipt table.
    I saw an earlier posting on the same exception that mentioned "collection
    element-type" - mine is specified as "Trade", ie the subclass.
    Is there any reason why this should not work?
    I can provide you with .jdo and .mapping files if necessary.
    Many thanks,
    Alex
    Marc Prud'hommeaux
    SolarMetric Inc.

  • One to Many Mapping with different SQL types

    We have an interesting one to many relationship in our system in which the source and target field SQL types do not match, but the values do. The relationship is actually between multiple entries in the same database table. So, imagine we have some table that looks sort of like this:
    KEY ObjectID OwnerNo
    100 1234     0
    101 ABCD     1234
    102 EFGH     1234ObjectID is defined as a varchar type, but Parent entries are guaranteed to have integer value ObjectIDs. Child entries point to the parent through the OwnerNo field, which defined in the database as a numeric.
    A simple one-to-many mapping will give you the following SQL error on execution: [SQL0401] Comparison operator = operands not compatible.
    I tried modifying my descriptor after load as follows:
       public static void modifyOneToMany(Descriptor descriptor)
           ExpressionBuilder builder = new ExpressionBuilder();
           Expression exp = builder.getField("OwnerNo").
              equal(builder.getField("ObjectID").toNumber());
           descriptor.getMappingForAttributeName("children")
              .setSelectionCriteria(exp);
       }But this introduces two problems in the generated SQL ( ... WHERE ((t0.OwnerNo = TO_NUMBER(t0.ObjectID) ... ). First, this generates a where clause using the function TO_NUMBER, which is not supported by DB2 on AS400, our database platform. Second, the table reference is off in the generated SQL--I couldn't find a way to specify that the right hand side of the = operator should be from the parent of the one to many mapping--both sides are referenced from the child context (t0).

    I found the getFunction() method on Expression, so I can solve half of this problem with the following code:
       public static void modifyOneToMany(Descriptor descriptor)
         if (descriptor.getMappingForAttributeName("children").isOneToManyMapping())
           OneToManyMapping map = (OneToManyMapping) descriptor.
                                  getMappingForAttributeName("children");
           DatabaseField objectID= (DatabaseField) map.getSourceKeyFields().get(0);
           DatabaseField ownerNo = (DatabaseField) map.getTargetForeignKeyFields().get(0);
           ExpressionBuilder builder = new ExpressionBuilder();
           Expression exp = builder.getField(ownerNo).getFunction("CHAR").
                            equal(builder.getField(objectID));
           map.setSelectionCriteria(exp);
       }This generates the following where clause:
    ... WHERE ((CHAR(t0.OwnerNo) = t0.ObjectID) ...
    But, I still have two questions:
    1. How do we get the right hand side of this comparison to reference the Parent part of the 1-M mapping?
    2. Since character and numeric conversions are pretty standard SQL functions, is there something wrong with the DB2 database platform I'm using?

  • Key Method in one to many mapping

    I have problem in one to many mapping. I use a composite key and use get method of that key as Key Method, toplink seems not to realize this change, and can't acommodate that.
    any one had same problem?

    Could you explain in more detail what it is you are tyring to do? By 'Key Method' do you mean you are using a Map as the collection type of a OneToMany mapping? What do you mean by change? Are you changing the composit key?
    --Gordon                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Partial Attribute search on a one to many mapping

    Is it possible to include an attribute that is a one to many mapping as a partial attribute in a Read All Query?

    Is it possible to include an attribute that is a one to many mapping as a partial attribute in a Read All Query?

  • Setting criteria on one-to-many mapping

    Hello,
    A quick question. Let's say you have two tables, TABLE A and TABLE B. TABLE A- which has a one to many relationship with TABLE B.
    When I do a query to get an object from TABLE A, I also get back a collection of TABLE B objects. I'd like to be able to alway be able to restrict the TABLE B objects I get back by adding an additional criteria like "where TABLE_B.DRAFT = 'N'" so that I always only get back TABLE B objects that are not drafts. Is there anyway to add this to the DirectToField Mapping or anywhere else in the Toplink Project so that I don't have to specifically setup the query in my DAO code?
    Thanks in advance for any help,
    Mark

    This is a follow-on to the previous question. I've been asked to create a domain object, Member, that would have two relationships with the child table Rec (Recommendations), a one-to-one mapping with the only record in the Rec table that has is "approved", and a one-to-many mapping with all the records for the Member. I realize from the answer received above that putting criteria in a mapping isn't recommended, but did want to see if it was even doable in case it was needed. Unfortunately, I get this error below:
    "A non-read-only mapping must be defined for the sequence number field."
    Below are my relevant mappings. Any thoughts on this?
    Thanks,
    Mark
    OneToOneMapping approvedRecInfoMapping = new OneToOneMapping();
         approvedRecInfoMapping.setAttributeName("approvedRecInfo");
         approvedRecInfoMapping.setGetMethodName("getApprovedRecInfoHolder");
         approvedRecInfoMapping.setSetMethodName("setApprovedRecInfoHolder");
         approvedRecInfoMapping.setReferenceClass(domain.Rec.class);
         approvedRecInfoMapping.useBasicIndirection();
         approvedRecInfoMapping.readOnly();
         approvedRecInfoMapping.addForeignKeyFieldName("PROM_REC.PRM_ID", "PROM_REC_MEMBER.ID");
         approvedRecInfoMapping.setSelectionCriteria(new ExpressionBuilder().get("approved").equal("true"));
         descriptor.addMapping(approvedRecInfoMapping);
         OneToManyMapping publicRecsMapping = new OneToManyMapping();
         publicRecsMapping.setAttributeName("publicRecs");
         publicRecsMapping.setGetMethodName("getPublicRecs");
         publicRecsMapping.setSetMethodName("setPublicRecs");
         publicRecsMapping.setReferenceClass(domain.Rec.class);
         publicRecsMapping.useTransparentCollection();
         publicRecsMapping.readOnly();
         publicRecsMapping.useCollectionClass(oracle.toplink.indirection.IndirectList.class);
         publicRecsMapping.addTargetForeignKeyFieldName("REC.PRM_ID", "MEMBER.ID");
         descriptor.addMapping(publicRecsMapping);

  • Simple one to many mapping question

    Hi,
    In the Toplink tutorial there is a one to many relation between Employee and PhoneNumber, and one to one between PhoneNumber and Employee.
    If I don't require can I eliminate the one to one relationship between PhoneNumber and Employee. Or Toplink requires it?
    Thanks
    -Mani

    Hi,
    The purpose of creating one-to-one back reference mapping in the target is so that the foreign key information can be written when the target object is saved. Alternatives to the one-to-one mapping back reference include:
    Use a direct-to-field mapping to map the foreign key and maintain its value in the application. Here the object model does not require a back reference, but the data model still requires a foreign key in the target table.
    Use a many-to-many mapping to implement a logical one-to-many. This has the advantage of not requiring a back reference in the object model and not requiring a foreign key in the data model. In this model the many-to-many relation table stores the collection. It is possible to put a constraint on the join table to enforce that the relation is a logical one-to-many relationship.
    Raanan.

Maybe you are looking for

  • Can I use two audio devices simultaneously ?

    I have Mackie Onyx 1620 with firewire card and I have also MOTU 828. Both devices are linked together. When using Logic Express 8 there is list on preferences/audio/devices and on that list there are both Mackie and Motu. But I can choose only one de

  • H:messages - Display order

    Hi, I have a form where the user enters *(1.zipcode 2.phone number 3.email address)* and i am using h:messages to display the messages at the top of the page. I would like the error messages to be displayed in the order of input field validations. JS

  • Can''t Stop Repeating iCal Event Alert!

    I am receiving repeating text messages for two iCal events. I can't make them stop. They are being resent over and over again. Well over 100 times today. I've deleted the events from both the iPhone and iCal on the computer the iPhone syncs to. Nothi

  • Can I join a trailer and iPhoto slideshow?

    I am trying to do a dvd of my granddaughter.  There are aroud 500 pictures.  I'm trying to do a slideshow in IPHOTO.  I've already done a trailer in IMOVIE.  Can I join the two?

  • Offline approval query

    Hi Experts, SRM 5 Classic scenario with offline approval We have the offline approval process configured in the system for approval of Shopping Carts. I have two queries - 1. Once the email is generated for offline approval and transmitted to the res