One Mapping Many Times

Hi,
I have a situation where I have a simple mapping that needs to be run for many tables. All input and output tables have identical structure, and the internal mapping operations are constant for all invocations of this mapping. So, I need to drive a single mapping with runtime assignment of the input and output bound table names.
Incidentally, I have an indexed table with all fifty-odd input/output table names available. The mapping needs to run sequentially, so conceptually I need to loop through the indexed table, exeuting the mapping once per row.
Any ideas?
Regards,
Donna.

I think that was clear from your initial question..., the point we were making is that you cannot parameterize the mapping in the way you want.
The reason is that we would have to generate Dynamic SQL to allow the same code to handle different sources and targets (even if they are exactly the same).
The reason for that is that you have to re-compile the code to handle the new table names...
So the thing to do is fix your bound table names, then change the database implementation of the object you bind to. In other words you have a bound object called DONNA_SRC and DONNA_TGT, this is a synonym pointing to SRC1 and TGT1.
You execute mapping first time, reading/writing SRC1 and TGT1, then in post mapping process you register this as success in you table.
Run mapping again, in pre mapping read from table the next table names. In this proc change the synonyms, run mapping etc.
YOu keep on going. To run in batch there are various possibilities, either process flow (contains the map 50 times or so), or in a pl/sql program, that loops through the table and drives it off of that. Same basic principle.
Jean-Pierre

Similar Messages

  • Ipod disabled, changed my password but entered the wrong one too many times!

    ipod disabled, changed my password but entered the wrong one too many times!
    Didnt have a pc with ituens before either but now have one although dont quite know what to do.

    plug your ipod touch into your computer in recovery mode. (see herehttp://support.apple.com/kb/ht1808)
    Reset all data and settings
    dont restore from backup
    sync back content

  • Hi my mom tried my password one to many times and now i am disabled and cant get into my phone at all, it just allows for emergency calls.

    hi anyone to there know how to fix my problem. my mom tried my password one two many times and now my phone is disabled and i cant use it unless its a emergency.

    iOS: Forgot passcode or device disabled
    I hope you back up on a regular basis.

  • Send one request many times

    Hi Experts
    I have scenario where first request should go from XI.means
    XI should initiate a request with an XML file to the target system. This request should send 10 times for every 10 min and each time there is field in xml ( COUNTER field) should increase by one. Like if the counter contains value 1 if i am sending request for first time second time it should be 2 like that. But i should not hard code this value any where.
    Is it passoible to send one request 10 times with each time increasing the count.
    Please suggest me.
    Thansk & Regards
    Ravi Shankar B

    You may create and schedule an ABAP report doing the stuff you want.
    1. Create content of XML file
    2. read current count value from own z table
    3. add 1 to counter
    4. store new value in z table
    5. handover the stuff to Integratiomn Engine e.g. using sRFC or tRFC
    6. PI sends the stuff as XML file
    Schedule this report to run every 10 min.
    Regards,
    Volker

  • Referencing one object many times

    Hallo,
    I have an m:n relationship between products and spareparts (both object tables):
    create or replace type sparepart_TY as object(
    sparepartid number,
    designation varchar2(50)
    create or replace type sparepart_NT as table of ref sparepart_TY
    create or replace type product_TY as object(
    productid number,
    designation varchar2(50),
    spareList sparepart_NT
    create table spareparts of sparepart_TY
    create table products of product_TY
    nested table spareList store as spareList_NT_TAB
    This way I can reference many spare parts to one product.
    But how can I show, that one product has the same spare part several times?

    As Chris suggests, you can
    reference several times the same instance:
    insert into spareparts values (101, 'SP 1');
    insert into spareparts values (102, 'SP 2');
    insert into products values (
      '1', 'P 1',
      sparepart_NT (
        (select ref (sp) from spareparts sp where sparepartid = 101),
        (select ref (sp) from spareparts sp where sparepartid = 102),
        (select ref (sp) from spareparts sp where sparepartid = 102)
    );or redefine the type "sparepart_nt" to contain, in addition to the ref, a new attribute "quantity":
    create or replace type sparepart_ref_qty_TY as object (
      sparepartref ref sparepart_TY,
      quantity number (2)
    create or replace type sparepart_NT2 as table of sparepart_ref_qty_TY
    create or replace type product_TY2 as object (
      productid number,
      designation varchar2(50),
      spareList sparepart_NT2
    create table products2 of product_TY2
      nested table spareList store as spareList_NT_TAB2
    insert into products2 values (
      '1', 'P 1',
      sparepart_NT2 (
        (sparepart_ref_qty_TY ((select ref (sp) from spareparts sp where sparepartid = 101), 1)),
        (sparepart_ref_qty_TY ((select ref (sp) from spareparts sp where sparepartid = 102), 2))
    );But, I don't like REF's and object tables.
    First, REF can't replace good old foreign keys. After:
    delete spareparts;
    we have "dangling REF's" in products (in nested table spareList).
    C.J.Date in "An introduction to Database Systems" (eighth edition, 2004, chapter 26)
    says that using REF's in relational databases we make "The Second Great Blunder":
    - "The blunder consists of mixing pointers and relations"
    - "The Second Great Blunder undermines the conceptual integrity of the relational model in numerous ways"...
    "The First Great Blunder" is to equate object classes and relational variables,
    simply speaking - to have object tables (tables in which each row represents an object).
    Without "The First Great Blunder" (object tables) we can't make "The Second Great Blunder" (using REF's),
    but we can have object tables without REF's.
    The "proper way" (in Date's sense) of how to use "object-relational" features is - to use object type as domain.
    Regards,
    Zlatko

  • How to link a fact table to one dimension many times

    I have fact table which contains four date fields and I want to connect all of them to the Time dimension. I think I probably must split this fact table to multiple tables and then link them to dimensions. What is the right way to solve this kind of problem?
    Example: Fact table: TimeIn, TimOut, TimeStart, TimeStop, InPlace, OutPlace, StartPlace, StopPlace, Speed, Weight, Width, Height .....
    Thank you

    Hello Kostis,
    thank you for your answer. I don't fully understand you. Can you show me short example, please? I create alias table for time dimension on Physical Layer - original table is TimeDayDim and I create aliases TimeDayDim1, TimeDayDim2, TimeDayDim3, TimeDayDim4. Then I create foreign key Fact.Time1 -> TimeDayDim1, Fact.Time2 -> TimeDayDim2, Fact.Time3 -> TimeDayDim3, Fact.Time4 -> TimeDayDim4. And what now? Must I create these table api Bussines Model and create new time dimensions at bussiness model????
    I need in Answers ONE Time dimension. I think I must split my fact table to four tables ... (time1, place1 ...) (time2, place2 ...) (time3 place3...) (time4 place4...) then link those tables to Time dimension (but I dont know where I can split those tables - on Physical Layer or on Bussines Layer).
    I suppose that I will have in Answers one time dimension and four facts tables and I will be able to query them. (for example: Time.Days, Fact1.Place1, Fact3.Speed, Fact4.Count Criteria: Time.Year = 2008)
    Best Regards Vlada

  • Repeat one recordset many times

    I have a recordset that will always return 1 record with anywhere from 1 to 16 tbl.Fields, which is where my problem starts. Since I can't use repeat region I need to get this recordset to repeat multiple times depending on the  session variable (Session("Times").
    (<% Session("Times") = Session("Quantity") / Session("Fields") %>
    My question is, is there any way to repeat this recordset so it will be displayed on a page equall to Session("Times")  ?
    Example: Session("Quantity") could = 900  and Session("Fields") could  = 3 so I would like this recordset repeated 300 times
    Another one: Session("Quantity") could = 500  and Session("Fields") could  = 10 so I would like this recordset repeated 50 times
    The returned (repeated) data would have 3 fields displayed 300 times
    Or 10 fields displayed 50 times
    Thanks

    On the page I got
    Message1line1
    Message1line2
    Message1line3
    Message1line1
    etc for 51 loops but for only one message.
    So then I divided 51 by the number (x) of records (from another recordset rsNumberOfMessages_total) I now get
    Message1line1
    Message1line2
    Message1line3
    Message1line1
    Message1line2
    Message1line3
    Message1line1
    Message1line2
    Message1line3
    Message1line1
    X amount of times (equal to the others) then
    Message2line1
    Message2line2
    Message2line3
    X amount of times (equal to the others) then
    Message3line1
    Message3line2
    Message3line3
    X amount of times (equal to the others)
    Here's the code area.
    <% Session("Times") = 51 / Session("NumbOfMessages") %>
    <%
    While ((Repeat1__numRows <> 0) AND (NOT rsMessages.EOF))
    %>
    <table width="100%" border="0" cellpadding="0" cellspacing="0" id="message">
    <%
    i=0
    Do Until i>= Session("Times")  ' returns an equal amount of messages before it displays the next message, etc... 
    i=i+1  
    %>
    <tr>
        <td width="225" align="center" valign="top" nowrap> <font size="<%=Session("Pitch")%>" face="<%= Session("FontName")%>">
         <br>
    <%=(rsMessages.Fields.Item("IC_Line1").Value)%><br>       
            <%=(rsMessages.Fields.Item("IC_Line2").Value)%><br>
            <%=(rsMessages.Fields.Item("IC_Line3").Value)%><br></font> </td>
      </tr>
      <tr>
        <td width="225" align="center" valign="top" nowrap> </td>
      </tr>
      <% Loop %>
    </table>
    <%
      Repeat1__index=Repeat1__index+1
      Repeat1__numRows=Repeat1__numRows-1
      rsMessages.MoveNext()
      Wend
      %>
    I haven't worked with nested loops, if that is looping outside of the repeat regin, I tried that orginally and it returned nothing.
    Thanks for helping me with this hair puller...

  • How to use one ResultSet many times in a jsp page ?

    Hi all,
    I have .jsp page and I have used it to get data from DB and display them to users. So I have to get data from DB in number of places in this particular jsp.
    I thought that it is better to have one ResultSet for entire page and once it is done its job, the ResultSet will be closed and I can use it again and again like this.
    Resultset rs = new ResultSet();
    try{
        //My operations
    }catch(Exception ex){
       //Handle Exceptions
    }finally{
       rs.close();
    }After above code snippet I can use same ResultSet again below the page.
    I just want to know this,
    1. is this a good coding practice?
    2. Should i put rs = null; within finally clause?
    any help will be appreciated
    thank in advance,
    Dilan.

    Ok, Finally I switched my coding to use DAO and DTO, and I learned it through internet.
    I removed all of data access codes from my jsp file(lets say 'functions.jsp'). I then created one interface and two clasess.
    here is my DAO interface.
    public interface UserFunctionsDAO{
        public List<UserFunctionsDTO> selectUserList();
    }here is DTO class
    public class UserFunctionsDTO{
        private String category = "";
        private String sub_category = "";
        private int cat_id = 0;
        private int sub_cat_id = 0;
        public UserFunctionsDTO(){}
        public UserFunctionsDTO(String category, String sub_category, int cat_id, int sub_cat_id){
            this.category = category;
            this.sub_category = sub_category;
            this.cat_id = cat_id;
            this.sub_cat_id = sub_cat_id;
        //Setters and getters will go here.
    }my concrete data access class is like this.
    public class UserFunctionsDataAccess implements UserFunctionsDAO{
        MyDB dbObject = null;
       private static final String SQL_GET_DISTINCT_CAT= "SELECT DISTINCT cat FROM cat_table";
       public List<UserFunctionsDTO> selectUserList(){
           dbObject = new MyDB();
           dbObject.sqlSelect(SQL_GET_DISTINCT_CAT);
           ResultSet rs = dbObject.getResultSet();
           ArrayList list = new ArrayList();
           while(rs.next()){
               list.add(new UserFunctionsDTO(rs.getString('category'), .......................));
           return list;     
    }I think now im following good coding practices, but I have one problem.
    1. How do I retrieve this userlist from my jsp page?
    2. Should I include UserFunctionsDTO in my jsp page as a bean?
    3. If I include it, how can I get the list from it?
    thanks in advance,
    Dilan.

  • HT1212 my daughter has a brand new ipod touch - never used - she entered a passcode then immediately forgot it and now she has tried to enter one too many times and ipod is locked for 1 hour - she has never synced with itunes HELP

    my daughter has a brand new ipod touch - latest one - she started to input a passcode then didn't finish the process then turned off ipod. she turned it back on and it is asking for a passcode - she doesn't remember what she typed. Ipod is now disabled for one hour. Can we override the disable. How do we reset passcode when we don't klnow the original. It has never been synced to Itunes. I am completely lost.

    If You Are Locked Out Or Have Forgotten Your Passcode
    iTunes 10 for Mac- Update and restore software on iPod, iPhone, or iPad
    iPhone, iPad, iPod touch: Wrong passcode results in red disabled screen
    iOS- Understanding passcodes
         If you have forgotten your Restrictions code, then follow the instructions
         below but DO NOT restore any previous backup. If you do then you will
         simply be restoring the old Restrictions code you have forgotten. This
         same warning applies if you need to restore a clean system.
    A Complete Guide to Restore or Recover Your iDevice (if You Forget Your Passcode)
    If you need to restore your device or ff you cannot remember the passcode, then you will need to restore your device using the computer with which you last synced it. This allows you to reset your passcode and re-sync the data from the device (or restore from a backup). If you restore on a different computer that was never synced with the device, you will be able to unlock the device for use and remove the passcode, but your data will not be present. Refer to Updating and restoring iPhone, iPad and iPod touch software.
    Try restoring the iOS device if backing up and erasing all content and settings doesn't resolve the issue. Using iTunes to restore iOS devices is part of standard isolation troubleshooting. Restoring your device will delete all data and content, including songs, videos, contacts, photos, and calendar information, and will restore all settings to their factory condition.
    Before restoring your iOS device, Apple recommends that you either sync with iTunes to transfer any purchases you have made, or back up new data (data acquired after your last sync). If you have movie rentals on the device, see iTunes Store movie rental usage rights in the United States before restoring.
    Follow these steps to restore your device:
         1. Verify that you are using the latest version of iTunes before attempting to update.
         2. Connect your device to your computer.
         3. Select your iPhone, iPad, or iPod touch when it appears in iTunes under Devices.
         4. Select the Summary tab.
         5. Select the Restore option.
         6. When prompted to back up your settings before restoring, select the Back Up
             option (see in the image below). If you have just backed up the device, it is not
             necessary to create another.
         7. Select the Restore option when iTunes prompts you (as long as you've backed up,
             you should not have to worry about restoring your iOS device).
         8. When the restore process has completed, the device restarts and displays the Apple
             logo while starting up:
               After a restore, the iOS device displays the "Connect to iTunes" screen. For updating
              to iOS 5 or later, follow the steps in the iOS Setup Assistant. For earlier versions of
              iOS, keep your device connected until the "Connect to iTunes" screen goes away or
              you see "iPhone is activated."
         9. The final step is to restore your device from a previous backup. If you do not have a
              backup to restore, then restore as New.

  • Address label - one address many times

    i want to print a sheet of avery 5160 label paper with the same address on every label. can address book do this?

    Avery's free program does a very nice and easy job of dealing with this type of project:
    http://www.avery.com/avery/en_us/Templates-%26-Software/Software/Avery-DesignPro -for-Mac.htm
    You can Mail Merge with Apple's Address Book or build a single label manually, and customize the templates with your own artwork. - Tested with OS 10.6.2

  • I have  a iphn 3gs running on ios 6.1.3  i buy it frm my frnd ..........n it has one prblm that safari mail n maps does't wrk it crashes all time when i try to run these ......plzzz help me what shoud i do ......i have tried reset many times bt it does't

    i have  a iphn 3gs running on ios 6.1.3  i buy it frm my frnd ..........n it has one prblm that safari mail n maps does't wrk it crashes all time when i try to run these ......plzzz help me what shoud i do ......i have tried reset many times bt it does't

    use a computer and restore the phone http://support.apple.com/kb/ht1414

  • Many to One Mapping issue

    Hi Experts,
    I am currently facing issue with many to one mapping . I have a source schema called revenue having Profit and Profit GST which is looping multiple times. I need to copy the name,value and GST value for each type into the destination schema.
    i am using Looping funtiod to create item profit records and than copying name and value from source to destination but the problem statement is that i am unable to map the GST value
    Thanks
    Abhishek

    could you post the schema definition please
    well why i am asking is, in General matching the records will be based on common node values in corresponding records.
    Assume you have 2 records of Profit and 2 records of ProfitGST in the source message like below, you cannot match the records unless you have some value common in both the records. i mean there should be some common node or attribute value that exits in
    both records.
    assume the following sample with 2 records each
    <ns0:Revenue xmlns:ns0="http://TestSample">
    <ns0:profit availabilityIncentivePayment="342" increasedCapacityCharge ="121" increasedCapacaityPayment="231" />
    <ns0:profit availabilityIncentivePayment="100" increasedCapacityCharge ="110" increasedCapacaityPayment="120" />
    <ns0:profitGST availabilityIncentivePayment="55" increasedCapacityCharge ="21" increasedCapacaityPayment="23"/>
    <ns0:profitGST availabilityIncentivePayment="150" increasedCapacityCharge ="160" increasedCapacaityPayment="170"/>
    </ns0:Revenue>
    if you observe the above sample instance, it does have 2 records each, but Profit record's nodes values
    are no where common with ProftGST record's node values.
    And for every Profit record, you want to pick corresponding GST value from ProfitGST record. However, since you don't have atleast one common node/attribute value here, you will not find a way to relate corresponding records. Means while mapping the first
    record of Profit, it cannot decide which record's nodes values in the ProftGST should pick to match as there are 2 records of ProfitGSt and with no relation with Profit Records.
    if the requirement is such that the records should be matched by the order(index) irrespective
    or the values in them, then that can be achieved easily with postion() function in the for loop.  just try to use code some thing like below sample xslt script like below, apply the proper name spaces and put full names as applicable in your scirpt, mould
    it as per your need
    <ns0:Root>
    <xsl:for-each select="Profit">
    <Profit>
    <xsl:if test="@availabilityIncentivePayment">
    <name>
    name>availabilityIncentivePayment</name>
    </name>
    </xsl:if>
    <xsl:if test="@increasedCapacityCharge">
    <Value>
    <xsl:value-of select="@increasedCapacityCharge" />
    </Value>
    </xsl:if>
    <xsl:if test="../profitGST/@availabilityIncentivePayment">
    <ProfitGSt>
    <xsl:value-of select="../profitGST/@availabilityIncentivePayment[position()]" />
    </ProfitGSt>
    </xsl:if>
    </Profit>
    </xsl:for-each>
    </ns0:Root>
    Please mark the post as answer if this answers your question. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Help with multi-table mapping for one-to-many object inheritance

    Hi,
    I have posted on here before regarding this (Toplink mapping for one-to-many object inheritance but I am still having problems mapping my object model to my schema.
    Object model
    The Person and Organisation objects contain base information and have the primary keys person_id and organisation_id. It is important that there is no duplication of person and organisation records, no matter how many times they are saved in different roles.
    There are two types of licenceholder in the problem domain, and the ILicenceHolder interface defines information and methods that are common to both. The PersonalLicenceHolder object represents one of these types of licenceholder, and is always a person, so this class extends Person and implements ILicenceHolder.
    The additional information and methods that are required by the second type of licenceholder are defined in the interface IPremisesLicenceHolder, which extends ILicenceHolder. Premises licence holders can either be people or organisations, so I have two objects to represent these - PremisesLicenceHolderPerson which implements IPremisesLicenceHolder and extends Person, and PremisesLicenceHolderOrganisation which implements IPremisesLicenceHolder and extends Organisation.
    The model is further complicated by the fact that any single Person may be both a PersonalLicenceHolder and a PremisesLicenceHolderPerson, and may be so several times over. In this case, the same basic Person information needs to be linked to several different sets of licenceholder information. In the same way, any single Organisation may be a PremisesLicenceHolderOrganisation several times over.
    Sorry this is complicated!
    Schema
    I have Person and Organisation tables containing the basic information with the primary keys person_id and organisation_id.
    I have tried to follow Donald Smith's advice and have created a Role table to record the specialised information for the different types of licence holder. I want the foreign keys in this table to be licenceholder_id and licence_id. Licenceholder_id will reference either organisation_id or person_id, and licence_id will reference the primary key of the Licence table to link the licenceholder to the licence. Because I am struggling with the mapping, I have changed licenceholder_id to person_id in an attempt to get it working with the Person object before I try the Organisation.
    Then, when a new licenceholder is added, if the person/organisation is already in the database, a new record is created in the Role table linking the existing person/organisation to the existing licence rather than duplicating the person/organisation information.
    Mapping
    I am trying to use the toplink mapping workbench to map my PremisesLicenceHolderPerson object to my schema. I have mapped all inherited attributes to superclass (Person). The primary table that the attributes are mapped to is Person, and I have used the multi-table info tab to add Roles as an additional table and map the remaining attributes to that.
    I have created the references PERSON_ROLES which maps person.person_id to roles.person_id, ROLES_PERSON which maps roles.person_id to person.person_id and ROLES_LICENCE which maps roles.licence_id to licence.licence_id.
    I think I have put in all the relationships, but I cannot get rid of the error message "The following primary key fields are unmapped: PERSON_ID".
    Please can somebody tell me how to map this properly?
    Thank you.

    I'm not positive about your mappings, but it looks like the Person object should really have a 1:M or M:M mapping to the Licenceholder table. This then means that your object model should be similar, in that Person object could have many Licenses, instead of being LicenceHolders. From the looks of it, you have it set up from the LicenceHolder perspective. What could be done instead if a LicenceHolder could have a 1:1 reference to a person data object, rather than actually be a Person. This would allow the person data to be easily shared among licences.
    LicenceHolder1 has an entry in the LicenceHolder table and Person table. LicenceHolder2 also has entries in these tables, but uses the same entry in the Person table- essentially it is the same person/person_ID. If both are new objects, TopLink would try to insert the same person object into the Person table twice. I'm not sure how you have gotten around or are planning to get around this problem.
    Since you are using inheritance, it means that LicenceHolder needs a writable mapping to the person.person_id field- most commonly done through a direct to field mapping. From the description, it looks like roles.person_id is a foreign key in the multiple table mapping, meaning it would be set based on the value in the person.person_id field, but the person.person_id isn't actually mapped in the object. Check to make sure that the ID attribute LicenceHolder is inheriting from person hasn't been remapped in the LicenceHolder descriptor to a different field.
    Best Regards,
    Chris

  • Toplink mapping for one-to-many object inheritance

    Hi
    I currently have a Person object, extended by two specialist classes, PremisesLicenceHolder and PersonalLicenceHolder. I have mapped this in Toplink and it works fine saving a person into the specialist tables using the primary key person_id.
    However, a single Person may be extended any number of times by either one or both of the two specialist types. So, a Person may be a PremisesLicenceHolder many times over for different premises and licences, and also a PersonalLicenceHolder several times over.
    Is it possible to map this object model in Toplink avoiding duplicate person_id primary keys in the specialist tables?
    Thanks

    Hi,
    I am happy that my object model fits the problem domain. The Person and Organisation objects contain base information and have the primary keys person_id and organisation_id. It is important that there is no duplication of person and organisation records, no matter how many times they are saved in different roles.
    There are two types of licenceholder in the problem domain, and the ILicenceHolder interface defines information and methods that are common to both. The PersonalLicenceHolder object represents one of these types of licenceholder, and is always a person, so this class extends Person and implements ILicenceHolder.
    The additional information and methods that are required by the second type of licenceholder are defined in the interface IPremisesLicenceHolder, which extends ILicenceHolder. Premises licence holders can either be people or organisations, so I have two objects to represent these - PremisesLicenceHolderPerson which implements IPremisesLicenceHolder and extends Person, and PremisesLicenceHolderOrganisation which implements IPremisesLicenceHolder and extends Organisation.
    The model is further complicated by the fact that any single Person may be both a PersonalLicenceHolder and a PremisesLicenceHolderPerson, and may be so several times over. In this case, the same basic Person information needs to be linked to several different sets of licenceholder information. In the same way, any single Organisation may be a PremisesLicenceHolderOrganisation several times over.
    Sorry this is complicated!
    My initial idea for the schemas is to have Person and Organisation tables containing the basic information with the primary keys person_id and organisation_id. The Person table would have a one-to-many relationship with both the PersonalLicenceHolder table (pk: personalLicenceHolder_id, fk: person_id), and the PremisesLicenceHolderPerson table (pk: premisesLicenceHolderPerson_id, fk: person_id). There would also be a one-to-many relationship between the Organisation table and the PremisesLicenceHolderOrganisation table (pk: premisesLicenceHolderOrganisation_id, fk: organisation_id).
    I am flexible as to the design of my schema though, as I am happy to adopt any that will facilitate the Toplink Mapping.
    Thanks for your help with this.

  • Need help mapping one-to-many relationship

    [Sorry, inadvertently cross-posted]
    Hello,
    I have a one-to-many mapping question that's probably a no-brainer for the
    experts of the group out there. My problem is that I can't get a collection
    of Items for a given Theme to be populated and I don't know if it's a
    problem in my system.jdo or in my classes (or both). For example, for Theme
    10,
    I want a collection of two Items, item_ids 1 and 2.
    I have db tables named ITEM and THEME with the following layouts:
    ITEM
    |==========================================================|
    | item_id(pk) | item_name | item_number | theme_id(fk) |
    |==========================================================|
    | 1 | This is Item1 | 1234 | 10 |
    | 2 | This is Item2 | 2954 | 10 |
    | 3 | This is Item3 | 2094 | 17 |
    | 4 | This is Item4 | 946 | 11 |
    | ... |
    |==========================================================|
    THEME
    |=======================================|
    | theme_id(pk) | theme_description |
    |=======================================|
    | 4 | Space |
    | 10 | Town |
    | 11 | Train |
    | 17 | Pirate |
    | ... |
    |=======================================|
    I have two PersistenceCapable classes that map to the above tables:
    package com.lego.data;
    public class Item
    public int item_id;
    private String item_number;
    private String item_name;
    private int theme_id;
    public Theme theme;
    public String toString()
    return
    item_number+":"+item_name+":"+theme.getCode()+":"+theme.getDescription();
    package com.lego.data;
    import java.util.*;
    public class Theme
    public int theme_id;
    public String theme_description;
    public Collection items;
    public String toString()
    return theme_id+":"+theme_description;
    and here is my system.jdo file:
    <?xml version = "1.0" encoding = "US-ASCII"?>
    <jdo>
    <package name="com.lego.data">
    <class name="Item" identity-type="application"
    objectid-class="com.lego.data.IntOId">
    <extension vendor-name="kodo" key="table" value="item"/>
    <extension vendor-name="kodo" key="lock-column" value="none"/>
    <extension vendor-name="kodo" key="class-column" value="none"/>
    <field name="item_id" primary-key="true">
    <extension vendor-name="kodo" key="data-column" value="item_id"/>
    </field>
    <field name="item_number">
    <extension vendor-name="kodo" key="data-column" value="item_number"/>
    </field>
    <field name="item_name">
    <extension vendor-name="kodo" key="data-column" value="item_name"/>
    </field>
    <field name="theme_id">
    <extension vendor-name="kodo" key="data-column" value="theme_id"/>
    </field>
    <field name="theme">
    <extension vendor-name="kodo" key="theme_id-data-column"
    value="theme_id"/>
    </field>
    </class>
    <class name="Theme" identity-type="application"
    objectid-class="com.lego.data.ThemeKey">
    <extension vendor-name="kodo" key="table" value="theme"/>
    <extension vendor-name="kodo" key="lock-column" value="none"/>
    <extension vendor-name="kodo" key="class-column" value="none"/>
    <field name="theme_id" primary-key="true">
    <extension vendor-name="kodo" key="data-column" value="theme_id"/>
    </field>
    <field name="theme_description">
    <extension vendor-name="kodo" key="data-column"
    value="theme_description"/>
    </field>
    <field name="items">
    <collection element-type="Item"/>
    <extension vendor-name="kodo" key="inverse" value="theme"/>
    </field>
    </class>
    </package>
    </jdo>
    Thanks in advance for the help.
    -Tim

    Abe White wrote:
    The first thing to check is that you are always setting the "theme" field in
    your Items. If you add an Item i to the "themes" collection of a Theme t, but
    forget to also set i's "theme" field to t, then the change will never get
    written to the database.
    Next, make sure that whenever you set the "theme" field of an Item, you also
    set
    its "theme_id" field. You map both of these fields to the same column, so you
    better be sure they stay in synch.
    On a related note, you might try making the "theme_id" field non-persistent if
    things still aren't working for you. Mapping two fields to the same column
    might be causing trouble. It would be safer to make theme_id non-persistent
    anyway, and to always grab the id from the Theme stored in your "theme"
    field.
    Better OO programming and all that, though I can see that you might have
    performance issues in mind when doing it your way.
    Anyway, if you find that it works when you make theme_id nonpersistent, let us
    know and we'll see why the double-mapping of the column is causing problems,
    and hopefully find a fix.Abe,
    Thanks for the response but I'm still confused. I failed to mention that
    the Item and Theme tables are in an existing schema, so as you saw in my
    system.jdo, I am specifying application identity.
    Since this is an existing schema, the Item table has theme_id as the
    foreign key to the Theme table. So are saying that it is a problem to map
    the both theme_id as a data column and a Theme object in the Item at the
    same time?
    I guess what I don't understand is exactly what my system.jdo should look
    like to map a one-to-many relationship. In my case, from Theme (1) to Item
    (many). (See my system.jdo in previous post).
    Thanks
    -Tim

Maybe you are looking for