Bidirectional One-To-One relationship without Indirection possible?

Is it possible to create a One-to-One Bi-directional relationship without using Indirection?
When I have tried this, Toplink returns the same related rows from the two tables over and over again until it throws an error.
I need to use this relationship without indirection as I want to be able to query one table and have it return data from the associated table, without having to reference fields in the associated table in my query.
Do you have any suggestions that might help?
Thank you again,
Lena

Doug, I'm not sure I follow the reason behind this completely. Say we are only loading data from our database--we "promise" never to change it. What we are seeing is that TopLink seems to get stuck in a loop when it is loading objects with a 1-1 bi-directional relationship.
So, ObjectA loads, and has a reference to ObjectB; ObjectB loads and has a reference to ObjectA; ObjectA loads again and has a reference to ObjectB....you see the problem.
I thought that by specifying "maintain bi-directional relationship" we were basically telling TopLink: ObjectA has an ObjectB, and ObjectB will reference ObjectA, but there's no need to reload it.
I guess I'm just stuck on why it would be required to use indirection in this case, since we always want to load our related objects. Any thoughts?

Similar Messages

  • Unidirectional one-to-many relationship without a join table

    Hello,
    I have 2 classes, Invoice and InvoiceLine, and a one-to-many unidirectional relationship from Invoice to InvoiceLine. By default, with JPA, it would be mapped by a join table with foreign keys that refer to the 2 tables which represent Invoice and InvoiceLine.
    My problem: the database has already a foreign key in the table which represents InvoiceLine that refers to the table which represents Invoice.
    To solve my problem I could make the relationship bidirectional but I would like to know if it is possible to keep it unidirectional and to use the foreign key which already exists (in the table that represents InvoiceLine). How could I declare the mapping with JPA?
    Thanks in avance for your answers.

    JPA requires that any @OneToMany mapping not using a join table have an inverse @ManyToOne mapping. In general the foreign key in the target object needs to be mapped and a @ManyToOne mapping is normally the best way to map it, so making the relationship bi-directional is your best option.
    There are other ways in TopLink to map a unidirectional 1-m, but these are not directly supported by the JPA spec. You could define a TopLink OneToManyMapping for the relationship through a TopLink DescriptorCustomizer and the code API. You would still need to map the foreign key in the target object some way, but you could use a @Basic mapping for this as long as you keep it in synch.
    In TopLink you could also map the relationship using an AggregateCollectionMapping (basically a collection of embeddables), and then not require mapping the foreign key in the target, but this imposes limitations on the target object (must be treated like an embeddable instead of entity). You would also need to configure the target object to be an aggregateCollectionDescriptor if using this option.

  • Urgent : java bean having bidirectional one to many relationship

    Hi,
    We have complex requirement in our application.
    We need to copy java bean having bidirectional one to many relationship to another javabean having bidirectional one to many relationship..
    E.g
    Class Basket1 {
    public String color;
    pubic String type;
    public List<Basket1> basketList = new ArrayList()
    Class Basket2 {
    public String color;
    pubic String type;
    public List<Basket2> basketList = new ArrayList()
    We need to exact copy Basket1 to Basket2. We are in trouble to copy List of child because we do not have how many child Basket1 have of same type..
    Can someone help us how we can implement such kind of complex object bidirectional one to many relationship??

    I can't see anything bidirectional about these relationships. What I can see is a couple of BasketN classes that look identical so I don't know why they both exist, and they both contain lists of themselves as members, which suggests some kind of tree structure. Nothing bidirectional there. I can see tat these things can form circular object graphs but I don't see why you would want to do that.
    We need to exact copy Basket1 to Basket2And I don't know what that means. Please explain.

  • Is it possible to have a playlist that excludes the explicit songs without doing it one by one and that keeps it updated with purchases?

    Is it possible to have a playlist that excludes the explicit songs without doing it one by one and that keeps it updated with purchases?
    I want it for the kids but my computer constantly breaks and I am fed up with going through over 1000 songs every time it does!
    Thanks for any advice (other than buy a new computer!)

    Not fully automatically, no. iTunes doesn't expose the clean/explicit status to the smart playlist system, but if you're prepared to take a few seconds to tag new purchases, say by adding the keyword Explict into the grouping field, then it will be easy to create smart playlists that exclude those tracks. I use a similar scheme to tag tracks so they they go into seperate playlists for each member of the family, E,g, a grouping of Alice/Bob will go into each of Alice's & Bob's playlists, but not Charlie's.
    tt2

  • Understanding proxy indirection for one-to-one mappings

    The developer's guide states the following for proxy indirection:
    To use proxy indirection, your domain model must satisfy all of the following criteria:
    ** The target class of the one-to-one relationship must implement a public interface.
    ** The one-to-one attribute on the source class must be of the interface type.
    ** If you employ method accessing ("Configuring Method Accessing"), then the getter and setter methods must use the interface.
    My current descriptors all have get/set methods for their attributes. So does this mean that I need to create an interface for each descriptor that has corresponding get/set methods?
    If so, this seems to add a little overhead to maintaining the descriptors. Anytime an attribute is added, removed or modified in a way that would change the method signature; the interface must also be updated to reflect the change. Is there any way to avoid this overhead?

    The recommended approach for lazy loading one to ones is generally to use ValueHolders.
    Proxy indirection is a solution for lazy loading one to ones, not requiring TopLink classes (i.e. ValueHolders) to be imported and referenced in the Domain model. It also doesn't require code generation, or static byte code enhancement.
    In both solutions (regular ValueHolders or Proxy Indirection), TopLink needs to build the Domain objects with empty Place Holders. When the place holder is accessed, addition SQL and Object Building occurs. Coding to an interface in Proxy Indirection allows for the 'place holders' to be used under the interface without the user directly referencing ValueHolders. Without this interface TopLink couldn't do this. Proxy Indirection is not a perfect solution however.
    Using TopLink's JPA support (10.1.3 in preview mode, or 10.1.3.1) ValueHolders are dynamically put into the byte codes of the classes at runtime, allowing the user to have lazy loading without proxy indirection or putting ValueHolders in the Object model.
    Peter

  • How to insert data in a one-to-many relationship

    How do you insert data into the client, my model entity beans have a one-to-many relationship.
    PARENT ENTITY BEAN
    PARENT-ID
    PARENT-NAME
    The ejbCreate(Integer parentID,String name)
    CHILD ENTITY BEAN
    CHILD-ID
    CHILD-NAME
    PARENT-ID(foreign key of PARENTID).
    ejbCreate(Integer parentID,String name,String foreignparentID)
    In a jsp page i collect the parent details and 3 corresponding chld details in a text box.
    Can you please tell me how do i proceed from here...
    ie. how to i insert data into the entity beans..
    Do i pass the child as a collection, and within parents ejbCreate() method do i lookup for the childs home interface and insert one -by -one from the collection.
    1. Considering the above example, can some one pls tell how the ejbCreate() mehod signatures, for the parent and child entity beans should be.
    2. Pls also show some sample client code as to how to make an insertion.
    3. In case you are passing a collection of child data, then in what format does one have to insert into a collection and also how does the container know how to insert the values in the child table , bcoz we are passing as a collection.
    4.In case collections cannot be inserted do we need to iterate into the collection in parent's ejbCreate() method, and manually insert into the database of the childtable, thereby creating child entity beans.
    Thanks for your time and support...
    regards
    kartik

    Hi,
    3. In this case of course child's ejbCreate(and postCreate) looks like
    ejbCreate(Integer childID,String name,ParentLocal parent) {
    setId(Id);
    setName(name);
    ejbPostCreate(Integer childID,String name,ParentLocal parent) {
    setParent(parent);
    Here you don't need IDs, but it happens only using Locals, not Remotes, if I'm not wrong. Container does it itself.
    1. Of course, if you have parent.getChildren() and parent.setChildren() then you don't need any loops, but it should be done anyway in postCreate, because in ejbCreate there no parent exists yet.
    Once more 3: example - I'm using JBoss 3.2.5 as EJB container. It has tomcat inside and EJB and JSP+Struts use the same jvm. It means for me that I don't need to use remote interfaces, just locals. And in this case I can implement ejb-relations. So, a have the abstract method parent.getChildren() which returns Collection of ChildLocal - s and method parent.setChildren(Collection childrenLocals) which creates/modifies children by itself.
    I have not used remotes for a long time, but as I remember it was not possible to implement ejb-relations using remotes.
    regards,
    Gio

  • Struggling with a one to many relationship in a sub-report

    Post Author: Scott_tansley
    CA Forum: General
    I have a database schema as per below: tblENQUIRY                 tblDatasheets                  tblReportParasIRSID (PK)       1 --> &  IRSID (FK)                       UID (PK)Attribute1                     SHEETID (PK)     1 > &  SHEETID (FK)Attribute2                     Attribute1                         LIST_ORDER                         tblStandardParasAttribute3                     Attribute2                         PARA_CODE (FK)    & < 1   CODE     (PK)etc...                            Attribute3                                                                     TEXT                                   etc...
    The PROBLEM I am a Crystal Reports Newbie, and having to work through things bit by bitu2026  I've managed to achieve quite a lot, but I'm totally stuck with this and would appreciate some help. I need to create a report (essentially a letter and some datasheets) around a one-to-many relationship, which I have managed to compile using a main report (for the one &#91;tblENQUIRY&#93;) and sub report (for the many &#91;tblDatasheets&#93;).  Essentially I need a covering letter, then the u2018manyu2019 datasheets, and then a number of other pages (which are largely static text). I have created a main report which includes the covering letter, holds a subreport for the datasheets, and then contains the text for the additional pages.  This all works fine, and I get the correct number of datasheets for each main report. My problem stems from the use of this sub report.  This sub-report needs to hold some attribute values for each datasheet, which is fine.  However, on each datasheet page I need to have some paragraphs, which are held in another one to many relationship.  Each datasheet may have up to six paragraphs held as a code in tblReportParas, with a relationship to the text as held in tblStandardParas. My original thought would have been to embed another sub report, containing the values from tblStandardParas!TEXT, into the first sub report.  However, I have found that it is not possible to have a sub-report inside another sub-report.  I had seperated the first sub-report out from the main report, and then embedded another sub-report into it.  This worked fine until I tried to stitch the sub-report back into the main report (at which point the sub-sub-report dissapeared from view). I have therefore reworked my sub-report a little, and the attribution is now stored in a pageheader, with the tblStandardParas!TEXT in a detail section below it.  This almost works! The only problem is that there is no relationship between the pageheader and detail sections.  To clarify, I would expect to have one datasheet, with the attribution at the top, and then the six paras below.  Then, the same on the next page (assuming there is a second datasheet) for that report.  Instead, I get the correct attribution, but the detail section actually gives every paragraph in the database, no matter which datasheet/or report it related to!  I therefore need to limit the detail section to only show those paragraphs where the SHEETID in tblReportParas is the same as the tblDatasheets SHEETID. Any offers of advice would be appreciated.

    Post Author: Scott_tansley
    CA Forum: General
    I managed to resolve this myself in the end.  I moves the tblEnquiry data into report header/footer sections, this allowed me to add the tblDatasheets information into the details section, which gave me multiple pages - and then finally, the Paragraphs were added through the use of a sub report. 
    There's probably an even better way, but for now it works, it's quick - and so I'm going to go with it!
    Thanks for your interest.

  • How do I create a One to many relationship page in Dreamweaver?

    How do I create a page in dreamweaver that comes up after the user logs in from the log in page that will allow the user to:
    Add, change and delete in 2 tables that are in my MYSQL database that is a one to many relationship
    One thing that is confusing is how the foreign key that links to the one side of the relationship is created in the many side without the user inputting the foreign key each time adding information to the many side table.
    I am creating this in Dreamweaver using a MYSQL database and PHP.

    >Would the following be a part of it:
    >
    >Outer join
    Probably not. When updating/inserting/deleting from 2 tables you perform each seperately. Table updates may join two or more tables to resolve the correct row(s) but you still only update one table at a time. Procedurally you would create a transaction, update the first table, update the second table and then commit the transaction.
    EDIT: Well I take back my last comment. I see that MySQL does seem to support multiple table updates. I don't use MySQL so I can't really help you on that but the MySQL manual gives pretty clear syntax.

  • FW CS5: Copy Page from one document to another without changing layers

    Hi,
    how can I copy a Page from one document to another without changing the layers?
    Drag-and-drop isn´t possible and by Copy-Paste all elements are placed in the same layer.
    Greetings,
    toho

    Use File > Import.
    Open the File, then navigate to the page you want to import
    Be sure to select Insert after current page, or FW will just import the content into the current page itself.

  • How to send big message one bye one without bpm in PI 7.0

    Hi frnds,
    I have to send a big messages one by one to the CRM, without using BPM.
    Can you please suggest us some way around, the data is going to CRM via proxy and at the sender side we are using file content conversion which we don't want to change.
    Please let me know some better idea and if possible some related example as well.
    Thanks,
    Raj

    Hi,
    You have two options
    1)Split the message and then send
    2)Use Record set per message option in File Sender adapter,there give value 20 or any number..then it takes 20 records at a time will send to receiver.
    BPM is not option,even if you use BPM ,its not going to solve your problem..
    Regards,
    Raj

  • How to change the fetch size for a one-to-many relationship

    With Toplink 10.1.3, since using scrollablecursor is a prerequisites for changing the fetchsize on a query (using the setFetchSize), I am wondering if it would be possible to change the fetchsize of the query which is associated to a one-to-many relationship.
    So, is this possible? How ?

    In TopLink 10.1.3 you can set the fetch-size on any query, it has nothing to do with using a ScrollableCursor.
    Example:
    readQuery.setFetchSize(100);
    To set the fetch size on a mapping query use,
    mapping.getSelectionQuery().setFetchSize(100);
    In 10.1.3 you can only set this in code, not currently through XML or the Mapping Workbench. In 10.1.3.1 you should be able to set the value through XML as well.

  • Problem with cascade delete in CMP one-to-one relationship

    I am not able to cascade delete for one-to-one relationship. Even though relationship seems to be setup correctly, record from the second table is not deleted.
    Following is the structure of tables i am using:
    First Table(vcc_lrmc) -- LRMCBean
    lrmc_id pk (Bean field is id)
    lrmc_dtl_id (Bean field islrmcDtlId)
    Second Table (vcc_lrmc_dtl) -- LRMCDetailBean
    lrmc_dtl_id (pk) (Bean field islrmcDtlId)
    lrmc_id (Bean field id)
    One to one bidirectional relationship has been setup with CMR fields moreLRMC and mainLRMC.
    section of ejb-jar is as follows:
    <ejb-relation>
    <ejb-relation-name>LRMCMainToDetail</ejb-relation-name>
    <ejb-relationship-role>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>LRMC</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>moreLRMC</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <multiplicity>One</multiplicity>
    <cascade-delete/>
    <relationship-role-source>
    <ejb-name>LRMCDetail</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>mainLRMC</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    section of orion-ejb-jar is as follows:(Bidirectional mapping)
    <entity-deployment name="LRMC" data-source="jdbc/VCCDS" table="VCC_LRMC">
    <cmp-field-mapping name="moreLRMC">
    <entity-ref home="LRMCDetail">
    <cmp-field-mapping name="lrmcDtlId" persistence-name="LRMC_DTL_ID"/>
    </entity-ref>
    </cmp-field-mapping>
    </entity-deployment>
    <entity-deployment name="LRMCDetail" data-source="jdbc/VCCDS" table="VCC_LRMC_DTL">
    <cmp-field-mapping name="mainLRMC">
    <entity-ref home="LRMC">
    <cmp-field-mapping name="id" persistence-name="LRMC_ID"/>
    </entity-ref>
    </cmp-field-mapping>
    </entity-deployment>
    Is there anything else need to be setup for Cascade delete or is there anything wrong the way one-to-one relationship has been setup.
    Pls. advice.
    Thanks
    Dhiraj

    Is it happening because of this bug.
    Cannot create a 1:1 bi-directional CMR for entity beans when database tables are reverse engineered. (2447364)
    Anyone, any idea on this ?
    Cheers,
    Dhiraj

  • How to generate lookup if there is one-to-one relationship?

    Hi,
    I am an new Jheadstart user and i am using Oracle Developer 10g with Jheadstart.
    There are two tables in my database with a one-to-one relationship between them.
    My database concept is that I need to have one table as a lookup of the other one. Jheadstart does not generate it that way because the relationship is not one-to-many, so I am not geting nor choice, nor lov.
    Could this possibly be solved?

    You probably get better answers in the JHeadstart forum.

  • MM- Material to Material Transfer Posting - One to Many Relationship

    We routinely have a situation where a material needs to be unpacked into several other materials.
    We are looking for a movement type or a simple solution (without using production order and co-products) that will allow us to accomplish this.

    Hi,
    Split of one material to several may not possible with industry solution. I believe it is available in is-retail. Please check.
    Please look at the usage of movement types 317 (Create struct. mat.) and 319 (Split structured mat).
    warm regards
    sairam akundi

  • Summarizing data in a one-to-many relationship

    Post Author: Bob Amiral
    CA Forum: General
    I use an order tracking system that has a one to many relationship between the main order information file and the line items file.  For each order, there can be one or more items in the items file.  I am having no luck trying to summarize data in such a way that shows selected information from the order file with only a summary from the item file on one line.  Instead, the reports expands by adding a line for each and every entry from the item file that relates to the order.
    How can I summarize data from the item file to show only one line of item data in the same line as the order data?

    Post Author: Charliy
    CA Forum: General
    Group by Order #
    Suppress the Detail (and possibly the Group Header, depending on how you want it to look)
    Put Running Totals in the Group Footer that reset on change of group.

Maybe you are looking for

  • Laptop Recommendations for a Future Engineering Student Using Arch

    First: I don't know if I am posting this in the right place, so I apologize in advance if it doesn't belong here. In September, I'm going to be starting an Electrical Engineering program at University and since I'll be in residence, I'm going to buy

  • LabVIEW Run-Time Engine 8.2.1 - Windows XP 32-bit

    Hi, Which version of the LABView runtime should i donload to work on 32bit ? there is only 64bit ..... Kobi Kalif Software Engineer Solved! Go to Solution.

  • List and libraries in sharepoint 2010 content database

    I want to know when I create List or form library . where every form of form library will go. Will it save into content database ? I want to make report from the content database for form library or list ?

  • Can Illustrator do this? Need to help out a client!

    Hi All, I normally use PhotoShop for what illustration work I do (and it isn't much) but am trying to help a client out of a jam. I normally work in a CAD program, and have a client that I tried to help, but bottom line is they messed up big time and

  • Why is my Wifi access greyed out?

    I have been trying to help mom with her WiFi access on her Iphone 4s.  It used to work fine.  Now all of a sudden the Wifi access is greyed out so she cannot get Wifi.  This is a huge problem because we FaceTime to see each other and now we can't.  S