How to map M-N-O relationship with JDO

Hi,
I am relatively new to JDO so any help would be appreciated. I have a
database that has 4 tabels, Item, Section, Mechanism and
MechanismItemSection. MechanismItemSection is a mapping table between the
rest of the three tables. It contains the primary keys of all the three
tables(which makes the primary key for this table) and few more text
fields. In order to map it to the JDO objects, i created 4 classes for
each table and mapped the fields of the classes to the table.
However, i am having problem with the MechanismItemSection table. The
primary key of the table constitutes of three fields. How do i define an
objectID for such a table? Is this the right way of doing it or there is a
better way then this without having to change the schema for the database?
Thanks in advance

Dear Atif,
In order to customize primary keys you will want to use application
identity, whereby your application has complete control over the key
values.
A good overview of JDO identity types can be seen at:
http://www.solarmetric.com/Software/Documentation/2.3.0/jdo_overview_pc_identity.html
For example, in your case, you class might look like this (note that
this code is not tested at all):
public class MechanismItemSection
     public int myPK1;
     public short myPK2;
     public double myPK3;
     public String someStringField1;
     public String someStringField2;
     // ... etc ...
     // application identity class, implemented as an inner
     // class for convenience. Note that field names and types
     // must be public, and must match fields defined in the
     // MechanismItemSection class.
     public static final class Id
          public int myPK1;
          public short myPK2;
          public double myPK3;
          public Id ()
          public Id (String serialized)
               StringTokenizer tok = new StringTokenizer (serialized, ":");
               myPK1 = Integer.parseInt (tok.nextToken ());
               myPK2 = Short.parseShort (tok.nextToken ());
               myPK3 = Double.parseDouble (tok.nextToken ());
          public String toString ()
               String serializeString = myPK1 + ":" + myPK2 + ":" + myPK3;
               return serializeString;
          public int hashCode ()
               return (int)(myPK1 + myPK2 + myPK3);
          public boolean equals (Object other)
               Id otherId = (Id)other;
               return otherId.myPK1 == myPK1
               && otherId.myPK2 == myPK2
                    && otherId.myPK3 == myPK3;
In article <[email protected]>, ...Atif... wrote:
Hi,
I am relatively new to JDO so any help would be appreciated. I have a
database that has 4 tabels, Item, Section, Mechanism and
MechanismItemSection. MechanismItemSection is a mapping table between the
rest of the three tables. It contains the primary keys of all the three
tables(which makes the primary key for this table) and few more text
fields. In order to map it to the JDO objects, i created 4 classes for
each table and mapped the fields of the classes to the table.
However, i am having problem with the MechanismItemSection table. The
primary key of the table constitutes of three fields. How do i define an
objectID for such a table? Is this the right way of doing it or there is a
better way then this without having to change the schema for the database?
Thanks in advance
Marc Prud'hommeaux [email protected]
SolarMetric Inc. http://www.solarmetric.com
Kodo Java Data Objects Full featured JDO: eliminate the SQL from your code

Similar Messages

  • How to map or use remote cubes with flex (client) OLAPCubes?

    Hi,
    I have some remote cubes (Oracle or SSAS), I need to map them into the Flex cubes. Is it possible?
    If yes then please suggest me the way I can do this mapping to improve the performance at the clent.
    Thanks...

    found the solution in another approach.

  • A mapped elements relationship with other elements cannot be preserved

    Hi,
    I am trying to create an XML file from an XSD using excel macros and data from excel worksheet. The mapping takes place fine. However, when I try to save the mapped items into an XML file using SaveAsXML function, it gives me the following reason why the
    XML is not exportable:
    A mapped elements relationship with other elements cannot be preserved
    Could someone please help is resolving this issue?
    Thanks

    Preamble: I am not a specialist, on the contrary. I discovered xml a few days ago trying to submit returns based on two quite different compulsory xsd schemas established by local authorities. So this note has no other pretention than
    to try to help others starting from same level.
    The plus: I discovered I could do it (with limitations) from Excel 2010 by attaching the provided xsd and mapping the relevant fields to excel data cells. This is reasonably described on MS sites & elsewhere, although the MS tutorials
    do not focus on this particular objective, which is important as authorities are using more and more XML to expect returns.
    The minus: I stumbled across stupid issues (in fact pulling my hair...), which could be better highlighted in MS doc for the newbies like me, because at that stage of knowledge and on your own, all seems unsurmountable. When Excel gives
    the error messages, there is little indication on why and where the error occurs. My two common errors difficult to debug:
    1. Denormalized data error
    2. Relationship cannot be preserved error
    What I was doing wrong for the first xsd then even for the second by accident:
    1. In error, I was mapping an element occurring max once in the XSD schema to an element in an "Excel Table" (the “new” table formatting available in Excel 2010). I solved this by de-mapping the culprit element, converting the "Excel Table"
    to ordinary ranges using the button provided in the ribbon for this, and re-mapping. From there, (nearly) each time I was mapping a new element / attribute to a cell in the worksheet, I used the button "Verify map for Export" giving me debugging message soon
    enough before mapping the whole data set and finding it was wrong a bit late and not knowing exactly where it started to go wrong. Also, for the repeating component, I had set manually the Excel table for the whole recursive element beforehand as I found out
    that when using the dragging process, the results could be random (some attributes in the table, others in other tables resulting in errors type 2 relationship).
    2. Relationship error is a more nagging issue as it seems to relate to a structural limitation of this Excel 2010 export mechanism. Flattening a database with several depth levels (list of lists) is not trivial, so Microsoft stipulates
    a bit buried in notes while it should be in bold at the top that Excel (which version? also 2013?) "does not support recursive structures that are more than one level deep". Happily, while the xml schemas I had to follow where providing for several levels
    deep (3 in my case), I needed only one for both xml files.  So, I copied the “too complex” xsd schema, updated it manually to suppress 2 levels. I remapped and tested. The error messages had gone. I exported. Then, I had to simply add the
    previously deleted opening & closing tags manually using a free editor (Vim with thanks to that author).  
    But unless my understanding is wrong, which is quite possible, readers should understand that this documented limitation can become a structural stumbling block if they need absolutely recursivity with more than one level depth (list of lists). So, if
    I can do it in Access from a DB (I still need to find out how & forum guidance is more than welcomed), this will be my future way to explore.
    To finish, I validated the exported xml against the compulsory xsd schema using the online tool provided free by CoreFiling to ensure basic formatting mistakes had not been committed before submitting the returns for online validation
    by Authorities application. I have MS Visual Studio Express installed which may help as well but I don’t know how to use it for this.
    NB: I found also easier to copy (dragging top of the xsd tree) all the xsd elements /attributes in bulk from the xsd schema from the box on the right to a worksheet. While results would not be useable “as is” to map (it would most probably
    give errors), at least, it provides a good initial template with the right headings for all the elements / attributes facilitating restructuring (occurring once, elements part of a recursive table) then map properly and reasonably fast. Before doing this,
    I was copying manually the xml headings from the Word documentation provided by Authorities, which worked but was more cumbersome and risky.
    Conclusion
    I had never read about xml before (just heard often about it). It took me around 6-7 hours to learn some critical basics about it and about these specific xsd schemas. With a few trials & errors, I could use Excel 2010 to produce the
    xml files required for the two schemas I needed. The great advantage compared to an online submission of data to Authorities is that it a process easy to repeat quietly at work (or at home) and enabling to check peacefully and thoroughly the xml data files
    before submitting them.  If wrong submissions have been made, it enables automated corrections much easier as well. It is within reach for users with reasonable but not outstanding Excel / Xml knowledge but it requires some initial time investment.  
    Hope this saves time for others.
    acontrario
    Brussels

  • How can i install google maps on an iphone 3gs with latest os

    how can i install google maps on an iphone 3gs with latest os

    Actually Apple has developed its own maps and no more have it in sync with google as it did before so now apple has its own mapping software.
    http://www.nytimes.com/2012/09/20/technology/apple-ios-6-leaves-out-googles-maps .html?_r=0

  • How can i erase an account with relationship with some class of tax

    how can i erase an account with relationship with some class of tax

    Hi Enrique,
    I am not sure what you mean by this, can you please explain in more detail? You cannot erase accounts that already have transactions posted to it.
    Hope it helps,
    Adele

  • How to map IDoc segment with qualifiers

    Hi everyone!
    I have the following problem: In an IDoc of type DESADV01 there can be several segments of type E2EDS01. Each segment has a different qualifier, which is the value of the field SUMID in this case. My target structure (type EDIFACT) now has several segments, each again with a sort of qualifier. Now I have to map the values of certain source segments to the respective target segments.
    Exaple (in XML format):
    Source
      <E1EDS01 SEGMENT="1">
        <SUMID>021</SUMID>
        <SUMME>0000000001.000</SUMME>
        <SUNIT>KGM</SUNIT>
      </E1EDS01>
      <E1EDS01 SEGMENT="1">
        <SUMID>022</SUMID>
        <SUMME>0000000001.000</SUMME>
        <SUNIT>KGM</SUNIT>
      </E1EDS01>
    Target
      <S_MEA>
        <C_C502>
          <D_6313>N</D_6313>
        </C_C502>
        <C_C174>
          <D_6411>KGM</D_6411>
          <D_6314>1</D_6314>
        </C_C174>
      </S_MEA>
      <S_MEA>
        <C_C502>
          <D_6313>G</D_6313>
        </C_C502>
        <C_C174>
          <D_6411>KGM</D_6411>
          <D_6314>1</D_6314>
        </C_C174>
      </S_MEA>
    (i have omitted several details here, but I'm only interested in the general procedure anyway).
    So in general the source segment with qualifier "021" should be mapped to a target structure with qualifier "N" etc.
    How can this be done using standard XI mapping techniques?
    Regards, Joerg

    Hi everyone!
    Thanks for your input data - unfortunately this wasn't quite what I was looking for. However I thik I solved my original problem and I just wanted to share this solution with you - maybe it helps others, maybe some of you have suggestions what I could do differently.
    To sum up the requirement: There can be multiple input segments, each with a certain qualifier. These input segments have to be mapped to the target segments, respectively - however, the qualifiers change. There can be several segments with qualifiers that do not match the requirement, and required segments might be missing.
    So here's what I came up with:
    Use the qualifier of the source segments as an input to a <b>FixValues</b> function. In this function, map the desired qualifiers to the value <b>true</b>, use <b>false</b> as the default value. Map the output of the <b>FixValues</b> function to a <b>createIf</b> function and use this to create the desired output segment. This way, for each of the required segments, one target segment will be created. All other segments (with unwanted qualifiers) will be removed.
    So far, this technique worked for me - do you have improvements/suggestions?
    Regards, Joerg

  • How to map Idoc fields with external file

    Hi All,
    How to map Idoc fields with external file.
    I want to check the settings where Idoc fields are mapped with external file.
    Thanks in advance.
    Regards,
    Govind.

    If you have configured a fileport where on trigger of IDOC you are creating the file, you can look at the message type documentation and get the offset values for each field in each segment

  • How to map secondry elements with main if have same ids for both?

    I need to map secondry elements with its matching primary elements if they both have same id.
    How can this be achieved in xslt.
    If ids are not matching then not a single element of secondry sholud be shown.
    If ids matching, then other fields of secondry elements, should be mapped to similar fields of primary elements.
    Eg: Its like some program running and in between some add on programs started (may be trailor or advertisement).
    the add on program is not always shown (optional), and whenever shown it has its own data information etc etc.
    Please provide me some input, how to map and proceed.
    Not sure what this code is really doing.
    <xsl:template match="SECONDARY_EVENT_LIST">
              <xsl:variable name="secondaryElements" select="ancestor::SCHEDULE/SECONDARY_ELEMENT_LIST"/>
              <xsl:for-each select="SCHEDULE_ELEMENT_ID">
                   <xsl:variable name="id" select="."/>
                   <xsl:apply-templates select="$secondaryElements/SCHEDULE_ELEMENT[(@ID=$id)]"/>
              </xsl:for-each>
         </xsl:template>
    Is this having any relation with what my requirement is all about?

    Hi,
    You can use XPATH command to get the exact tag.
    You can access each tag with it location like “/Report_Name/Group_Tag/Element_ID”.
    I think this will remove the ambiguity of Tags with same ID.

  • How to map the bulk users with the required  roles in portal at one time

    Hi,
    Would anyone tell me how to map the bulk users with the required roles in portal at one time?

    Thanks for all the reply.
    <b>I need to assign 1 or 2 group to n((eg) 1000)number of users</b>
    I tried the first option like
    [group]
    gid=
    gdesc=
    user=
    Thr problem with this is I could n't put more no of users in the notepad.
    I would be able to put only 150 users in the single line of notepad. If it goes to next line it is not working.
    I tried creating seperate notepad but in Import it says "exists"
    I'm not sure about LDAP. Would anyone explain me the best approach to do this.

  • How to Map Proces form field with Resource form field?

    Hi,
    How to Map Proces form field with Resource form field while creating Process form in Form designer

    Are you talking about Provisioning ?
    then you do that in Data Flow under Process Defintion in OIM 10g
    In OIM 11g you use Request Dataset. In that you can directly map fields to process form.

  • How i map the caf data with data of UWL in web dynpro

    Hi Experts,
    i created a bpm project with nwce 7.1.1 and it have a independent caf to keep it's data and status.
    now i have to create a view(use web dynpro) such like UWL,
    my question is
    how i map the caf data with UWL, and let the view can open the task(popup a window, just like UWL do) for user to finish their job?
    thanks.

    Hi Vic
    Your requirement is exect functionality of UWL based on WEBDYNPRO, CAF and BPM for automation? ,and question is How to use CAF with WD or CAF with UWL API's ?. please clarify it.
    Please fo through from given doc misght give u some idea
    1. [How to develop Web Dynpro UI for your CAF project |http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417300)ID0722080650DB02400261803144436507End?blog=/pub/wlg/5414]
    Best Regards
    Satish Kumar

  • How we map with KOMT1 in IPC javamethods

    Hi All,
    How can we map the fields fo KOMT1 with IPD java methods means which class can be considered.
    For XKOMV, the class IPricingConditionUserExit can be used, like that for KOMT1 structure which class can be used. Following is the part of my requirement.
            clear komt1-GRLNR.
          if xkomv-KZBZG is initial and not komt1-grmen is initial.
            xkomv-konms = komt1-grmen.
            xkomv-KZBZG = komt1-kzbzg.
            xkomv-stfkz = 'A'.
    Appreciated for ur help.
    Thanks
    Seshagiri

    Hi,
    You may please check in this forum
    Also, please explore whether [IS-Healthcare|http://help.sap.com/content/documentation/industry/docu_is_health.htm] helps you finding a solution.
    Regards,
    P Gomatheeswaran

  • How to map a query with the Multiprovider?

    Hello All,
    Can any one please tell me how to map a query with a multiprovider?
    Appreciate your help.
    Regards,
    Soumya.

    Hi,
    Can you please elaborate , do you mean how to create a query with multiprovider. if that is your question it is very simple just create the query on the multiprovider.
    What is the purpose for mapping the query with multiprovider

  • How to map CRM BP relationship and R/3 customer partner funnction

    Hello !
    Please, I need the following actions:
    1) during BP initial download from R/3 to CRM, a specific partner function should be mapped by a CRM relationship (Example: in R/3 master data, customer X is the Payer of customer Y. I'd like this partner function "Payer" should be mapped by BP relationship "Payer" in CRM);
    2) a particular relationship between BPs in CRM should be mapped by  the corresponding R/3 partner function during upload from CRM to R/3.
    Please, can anyone help me ?
    Thank you.
    Kind regards.
    Elena

    Hi, Venkat.
    Thank you for your answer, but the question is: is it possible to define the correspondece between R/3 partner function and CRM relationship ? I know transaction PIDE: it allows to map R/3 accont group and CRM roles.
    Thank you very much.
    Bye.
    Elena

  • How to Replace New Maps app on ios 6 with Google Maps?

    Can someone please  provide the procedure to replace the new maps app on ios 6 with Google Maps?
    Thank you

    You can still use Google’s maps — on the Web. Visit maps.google.com and accept the offer to create a Home-screen icon for you. You won’t get spoken directions, but you’ll get written directions, public transportation details, live traffic reports and, of course, Google’s far superior maps and data. (In two weeks, you’ll be able to get Street View this way, too, says Google.) And you can install the Google Plus Local app for full access to Google’s more complete database of shops and businesses.
    You can also use someone else’s app. Many good ones cost money, but the MapQuest and Waze apps are free and offer spoken directions; Waze also incorporates real-time information about traffic jams, accidents and speed traps, collected by thousands of iPhones and Android phones on the roads.
    If you can wait a couple of months, you’ll be able to install Google’s own maps app; Google is busily readying one for the iPhone and iPad.
     Cheers, Tom

Maybe you are looking for

  • Index Vs Primary Key of a table/Internal table

    Hello Friends, What is the difference between Key and Index of a table? What is the difference between creating an index and specifying "Is Unique" to "Yes" vs creating a Unique Key and specifying "Is Unique" to "Yes"? Thanks Simmi

  • Java stack installation error

    hi experts, Jan 21, 2021 1:14:55 PM  Info: Initial deployment: Selected development component 'PRTDatabaseMigrationController'/'sap.com'/'SAP AG'/'7.0100.20081117062041.0000'/'0' will be deployed. Jan 21, 2021 1:14:55 PM  Info: Initial deployment: Se

  • AppleScript input box issue

    I created an AppleScript on my Mac Pro and the text input box never shows up! I've tried other samples and it never shows up, I tested the same script on my MBP and it works fine. This looks like a stretched circle with a down arrow. Here is a screen

  • Help: Browse, Open command buttons

    I have a textbox in a form, i would like to have three command buttons: (Browse, open, Remove). when a user click the Brouse button, it should open the c:/directory allowing for choosing a file and when a user choos a file, a bath should be stored in

  • My Headphones Don't Work Properly

    Hi. I was just wondering how to get my headphones to work properly, my speakers work fine though... whenever I try to plug in my headphones, sound still comes out of the speaker like the headphones dont even exist. Is this a commen problem? One day t