Sorting on many side of relationship

I have a question.
There is one to many kind of relationship between Employee & Address table
Address table has following columns : id, street, city.
I have established one to many relationship in Employee class using valueholder.
But when I want to get address from Employee, I want address to be sorted on city column.
How can I do it?
e.g.
Expression exp = new ExpressionBuilder().get("empId").equal( "22");
ReadObjectQuery query = new ReadObjectQuery( Employee.class, exp );
Employee emp = (Employee)this.session.executeQuery( query);
ArrayList addresses= (ArrayList) emp.getAddresses();
// Here I want to get address sorted on some column (say city). How can I specify it.
1. I know, We can use ReadAllQuery.addAscendingOrder(). But here I want to use ReadObjectQuery
since I ma getting only 1 employee object. So I can't use ReadAllQuery
2. The other problem is in this case, sorting is required on many side of relationship.
So How can I achieve this using toplink?
Also, if I want to cache the results, can same solution be utilized?
Any help is highly appreciated.
Thanks.

You can configure sorting on the one to many mapping so that when the address list is retrieved from the database an ORDER BY clause is used. This can be configured in the mapping editor.
Sorting on the ReadObjectQuery does not apply as you will only be getting a single instance back. configuring it on the mapping is what you want.
Doug

Similar Messages

  • Problem Removing CMP 2.0 Bean from Many side of One-to-Many

    I'm getting an exception within the weblogic container when I try to
    delete a bean from the many side of a one-to-many CMR.
    The two entity beans are called CaseFile and CaseExpert. There are
    many CaseExperts for each CaseFile. When you call the remove method
    on the CaseExpert, Weblogic throws a null pointer exception when
    accessing the EntityCache as shown at the bottom of this message. I'm
    using the latest version of Weblogic 7 (WebLogic Server 7.0 Thu Jun
    20 11:47:11 PDT 2002 190955). My relationship section of my
    ejb-jar.xml file is also shown below.
    Any ideas?
    Thanks,
    David
    [email protected]
    javax.ejb.EJBException: EJB Exception:: java.lang.NullPointerException
    at weblogic.ejb20.cache.TxKey.<init>(TxKey.java:30)
    at weblogic.ejb20.cache.EntityCache.doGet(EntityCache.java:158)
    at weblogic.ejb20.cache.EntityCache.get(EntityCache.java:118)
    at weblogic.ejb20.manager.DBManager.getReadyBean(DBManager.java:252)
    at weblogic.ejb20.manager.DBManager.lookup(DBManager.java:949)
    at gov.usdoj.usa.ecms.casefile.exposure.ejb.CaseExpertBean_76ewyr__WebLo
    gic_CMP_RDBMS.__WL_setCaseFile(CaseExpertBean_76ewyr__WebLogic_CMP_RDBMS.java:45
    2)
    at gov.usdoj.usa.ecms.casefile.exposure.ejb.CaseExpertBean_76ewyr__WebLo
    gic_CMP_RDBMS.__WL_setCaseFile(CaseExpertBean_76ewyr__WebLogic_CMP_RDBMS.java:43
    1)
    at gov.usdoj.usa.ecms.casefile.exposure.ejb.CaseExpertBean_76ewyr__WebLo
    gic_CMP_RDBMS.ejbRemove(CaseExpertBean_76ewyr__WebLogic_CMP_RDBMS.java:1978)
    at weblogic.ejb20.manager.DBManager.remove(DBManager.java:876)
    at weblogic.ejb20.internal.EntityEJBLocalObject.remove(EntityEJBLocalObj
    ect.java:95)
    <relationships>
    <ejb-relation>
    <ejb-relation-name>caseExpert-caseFile</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>CaseExpert-CaseFile</ejb-relationship-role-name>
    <multiplicity>many</multiplicity>
    <relationship-role-source>
    <ejb-name>CaseExpertEJB</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>caseFile</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>CaseFile-CaseExperts</ejb-relationship-role-name>
    <multiplicity>one</multiplicity>
    <relationship-role-source>
    <ejb-name>CaseFileEJB</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>caseExperts</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type>
    </cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    </relationships>

    Wrong newsgroup, needs to go to one of the ejb newsgroups.
    mbg
    "Sai S Prasad" <[email protected]> wrote in message
    news:3ec28167$[email protected]..
    >
    Hi,
    I like to do the following:
    1) Map one bean corresponding to table A to many beans corresponding totable
    B 2) table B has two columns as the primary keys.
    3) One of the primary key column in table B is a foreign key pointing tothe primary
    key of table A.
    4) bean corresponding to table A has the cmr Collection field
    I am not able to map this scenario. I guess the mapping is possible aslong as
    each table has its own unrelated primary keys. If anyone has tried this,please...please...help.
    >
    >
    Thanks.

  • Many-to-one relationships

    I'm trying to implement a many-to-one relationship similar to the one, for example, between an OrderLineItem and a Product.
    I managed to create the beans and define the relationship using deploytool.
    What I'm trying to understand is how can I prevent a Product instance from being deleted when it is involved in the relationship described above?
    Currently, under Sun's reference implementation server, I am allowed to delete a Product even if there are OrderLineItems that reference it.
    There is one line printed out in the window running j2ee -verbose:
    com.sun.ejb.containers.EntityContainer$EJBTxKey
    The record in the Product table is deleted nonetheless.
    Another weird thing is that the server does not allow me to deploy two beans involved in a many-to-one relationships with the Product bean if they are using the same CMR field name. What I get is a compilation error at the deployment time.
    I'd appreciate any input.

    They way I handle this is to hide the creation/manipulation/deletion of the bean behind a manager - for example a singleton session bean. I NEVER allow the direct creation/deletion of entity beans except through manager classes. This is quite a common J2EE pattern, whose name escapes me at the moment.
    Your manager would have a method like delete(int productId), which would delete the matching Product entity bean, and would then search the OrderLineItem beans for the matching Product primary key.

  • Many to one relationships strange behavior

    I have a problem with two many to one relationships.
    The problem appears from the dirty mechanism of cmr/cmp fields.
    When I have two “many-to-one” relationships ex:
    A n..1 B
    A n..1 C
    Navigability: B -> A
              A <-> C
    When I put in ejb-jar.xml the B to A relation first, the bugs appear. The dirty mechanism work chaotic. The problem is in the generated code for the PersistenceManager and Wrapper of the A bean.
    In the Wrapper the only fields with dirty mecansim are the real fields from bean which are navigable. In the PersistenceManager class are the same fields like in the BeanWrapper plus the fake fields for relationship. But the fake fields are intercalated with real fields and the dirty flag values are not the same with the dirty flags from BeanWrapper. Result: chaotic updates.
    Solution(workaround – not elegant): put first the relation which has navigability from A to C and second A to B.

    They way I handle this is to hide the creation/manipulation/deletion of the bean behind a manager - for example a singleton session bean. I NEVER allow the direct creation/deletion of entity beans except through manager classes. This is quite a common J2EE pattern, whose name escapes me at the moment.
    Your manager would have a method like delete(int productId), which would delete the matching Product entity bean, and would then search the OrderLineItem beans for the matching Product primary key.

  • Persisting an instance of the many side of a in one to many relationship

    It seems as if most books only tell you how to setup the relationship for a one to many relationship but seems to fail to tell you the appropriate way to persist in this relationship. So, I have a parent class with many child classes. Also, I am using services and so I am converting from Entities to Dtos and visa versa.
    First, i want to insert a new child for the parent. Do I just convert the child Dto to a child entity and then persist the child entity with the reference to the parent? Then do I find the parent and add the child to the parents children so the entities are consistent?
    Or do I do a find on the parent and add the child to the parents children list and the child. Will the child be persisted automatically?
    With this said, what about updating a child? Do I remove the existing child and add a new one? or do I somehow find the child in the parents children set and update the info there and then somehow the child is persisted automatically? And since I am using Dto to entity, do I use a find to find the parent and then iterate through that parents children til I reach the child I modified by id somehow.
    What about Many to Many relationships? With a middle join table? How does JPA know to remove a join if I change the child reference? Does it remove the old and insert the new? Or do I have to do it myself somehow. Which if the later then I really can not have a parent child Dto I really need a parent childlink table where the child is referenced by the linktable? The book I have been reading has not made this very clear.

    Hello,
    The relationships cascade settings determine what should happen. I would not recommend persisting a new entity that references a non-managed entity. Instead either persist the child then make the associations or find the parent, make the associations then persist the child. In the second case, you do not need to explicietly persist the child if the parent->child relationship is marked cascade persist, since it will be found on flush or commit.
    Since you are using DTOs, updates require you merge the changes. You can directly merge the child, and if it has a link to its parent, modify the parent to add the child on the managed child that gets returned.
    As for ManyToMany, you must modify the side that controls the relationship. So if the parent owns it, then you must modify or merge the changes into the parent for the changes to be persisted to the database. If it is bi-directional, you must modify both sides so that the cache remains consistent with the database. This should be transparent to your application, and you only need an entity for the relation table if you want to map more complex information that doesn't fit into the JPA ManyToMany options. Otherwise, JPA should handle inserting and deleting enteries to the relation table for you.
    Best Regards,
    Chris

  • SD Billing document many to one relationship with sales order

    Hi experts,
    We have a scenario where we have done collective billing for some time.  So, obviously we have from sales order to billing one to many relationship.  Meaning, one sales order has many billing docs. 
    Now, we want to merge the sales order (VBAP) data with billing data (VBRP).  But, we want to take only one billing document which is appropriate.  
    For example, we have a sales order, corresponding that we have a billing debit memo followed by a cancellation, followed by another debit memo.  In this case we have to take the third debit memo as it is the latest and the first one has a cancellation.
    We will know alll this through VA02 Tcode.  However, we want to derive this logic off of the above tables.  We are actaully clue less as to how to pick up the right billing doc from VBRP for a sales order out of many.
    Please post ur replies.
    Thanks.

    Hi Jain,
    Thanks for the reply.  The sort out mechanism may not be the one we are looking for.  There may be several DIFFERENT billing docs for a single sales doc.  More over, these billing docs may have been created on the same date.  So, what we are looking for is a fied or information like XBLNR in VBAP with which we can for sure eliminate all other billing docs and cancellations against them, for exmaple, and pickup the right billing doc alone.
    I relly appreciate your efforts.
    Thanks.

  • One to Many with multiple tables on One side and one table on Many side

    Sorry for the confusion in the title. Here is my question. In my program, I have 2 different tables which store 2 different type of entities. Each one of entities has a list of attachments which I stored in a common attachment table. There is a one-to-many relationship between entity tables and attachment table.
    ENTITY_ONE (
    ID
    NAME
    ENTITY_TWO (
    ID
    NAME
    ATTACHMENTS (
    ID
    ENTITY_ID
    ATTACHMENT_NAME
    ENTITY_ID in ATTACHMENTS table is used to link attachments to either entity one or entity two. All IDs are generated by one sequence. So they are always unique. My question is how I could map this relationship into EntityOne, EntityTwo and Attachment JAVA class?

    For EntityOne and EntityTwo you can just define a normal OneToMany mapping using the foreign key.
    Are you using JPA, or the TopLink API? JPA requires a mappedBy for the OneToMany, so this may be more difficult. You should be able to just add a JoinColumn on the OneToMany and make the column insertable/updateable=false.
    For the attachment, you could either map the foreign key as a Basic (DirectToFieldMapping) and maintain it in your model, or use a VariableOneToOne mapping in TopLink (this will require the entities share a common interface).
    James : http://www.eclipselink.org : http://en.wikibooks.org/wiki/Java_Persistence

  • SQL functions extract and XMLSequence for a one-to-many (1:N) relationship

    I have have the following XML document loaded into a XMLType table. I'd like to retrieve the lineitem id together with the purchaseorder id and report id. How would the query look like? I've tried a lot but this one-to-many relationship is killing me.
    Many thanks!
    <report id=...>
    <purchaseorder id=...>
    <lineitems>
    <lineitem id=...>...</lineitem>
    <lineitem id=...>...</lineitem>
    <lineitem id=...>...</lineitem>
    </lineitems>
    </purchaseorder>
    <purchaseorder id=...>
    <lineitems>
    <lineitem id=...>...</lineitem>
    </lineitems>
    </purchaseorder>

    You can easily modify the above query to your needs:
    SQL> with qry as (
      2  select t.column_value.extract('/report/@id') report_id,
      3         t.column_value.extract('/report/purchaseorder') purchaseorder,
      4         t.column_value.extract('/report/purchaseorder/lineitems/*') lineitems
      5  from table(xmlsequence(xmltype('<document>
      6                                    <chapter>
      7                                      <report id="1">
      8                                        <purchaseorder id="1">
      9                                          <lineitems>
    10                                            <lineitem id="1">Item 11</lineitem>
    11                                            <lineitem id="2">Item 12</lineitem>
    12                                            <lineitem id="3">Item 13</lineitem>
    13                                          </lineitems>
    14                                        </purchaseorder>
    15                                        <purchaseorder id="2">
    16                                          <lineitems>
    17                                            <lineitem id="1">Item 21</lineitem>
    18                                          </lineitems>
    19                                        </purchaseorder>
    20                                      </report>
    21                                      <report id="2">
    22                                        <purchaseorder id="1">
    23                                          <lineitems>
    24                                            <lineitem id="1">Item 31</lineitem>
    25                                            <lineitem id="2">Item 32</lineitem>
    26                                          </lineitems>
    27                                        </purchaseorder>
    28                                        <purchaseorder id="2">
    29                                          <lineitems>
    30                                            <lineitem id="1">Item 41</lineitem>
    31                                            <lineitem id="2">Item 42</lineitem>
    32                                          </lineitems>
    33                                        </purchaseorder>
    34                                      </report>
    35                                    </chapter>
    36                                  </document>'
    37  ).extract('/document/chapter/*'))) t)
    38  select q.report_id,
    39         q1.column_value.extract('/purchaseorder/@id') purchase_id,
    40         q2.column_value.extract('/lineitem/@id') lineitem_id,
    41         q2.column_value.extract('/lineitem/text()') lineitem
    42  from qry q,
    43       table(xmlsequence(q.purchaseorder)) q1,
    44       table(xmlsequence(q1.extract('/purchaseorder/lineitems/*'))) q2
    45  /
    REPORT_ID  PURCHASE_ID     LINEITEM_ID     LINEITEM
    1          1               1               Item 11
    1          1               2               Item 12
    1          1               3               Item 13
    1          2               1               Item 21
    2          1               1               Item 31
    2          1               2               Item 32
    2          2               1               Item 41
    2          2               2               Item 42
    8 rows selected.
    SQL>

  • Many-to-One relationship with composed key

    Hi all,
    I have problems inserting an entity with a 1:n-relationship.
    The relationship is defined over two columns. In detail:
    There are two database-tables:
    VERDECK
    ID_PROJECT  NUMBER (key)
    ID_INTERN   VARCHAR2(10 BYTE) (key)
    UZSB
    ID_PROJECT          NUMBER (key)
    ID_UZSB             VARCHAR2(10 BYTE) (key)
    ID_PROJECT_VERDECK  NUMBER
    ID_INTERN_VERDECK   VARCHAR2(10 BYTE)
    On UZSB there is a referential integrity defined between these tables:
    FOREIGN KEY (ID_PROJECT_VERDECK, ID_INTERN_VERDECK)
    REFERENCES R57SCHRAUB.VERDECK (ID_PROJECT,ID_INTERN))
    This is mapped into JPA as follows:
    @Entity
    public class Verdeck implements Serializable {
         @EmbeddedId
         private VerdeckPK pk;
         @OneToMany(cascade={CascadeType.ALL},mappedBy="verdeck")
         private Collection<Uzsb> uzsbCollection;
    @Embeddable
    public class VerdeckPK implements Serializable {
         @Column(name="ID_PROJECT")
         private BigDecimal idProject;
         @Column(name="ID_INTERN")
         private String idIntern;
    @Entity
    public class Uzsb implements Serializable {
         @EmbeddedId
         private UzsbPK pk;
         @ManyToOne
              @JoinColumns({@JoinColumn(name="ID_PROJECT_VERDECK", referencedColumnName="ID_PROJECT"),@JoinColumn(name="ID_INTERN_VERDECK", referencedColumnName="ID_INTERN")})
         private Verdeck verdeck;
    @Embeddable
    public class UzsbPK implements Serializable {
         @Column(name="ID_UZSB")
         private String idUzsb;
         @Column(name="ID_PROJECT")
         private BigDecimal idProject;
    I try inserting a new entity VERDECK with some associated UZSBs as follows:
    Verdeck einVerdeck = new Verdeck();
    VerdeckPK myKey = new VerdeckPK();
    myKey.setIdProject(idProject);
    myKey.setIdIntern(lsId);
    einVerdeck.setPk(myKey);
    Uzsb lsUzsb = new Uzsb();
    UzsbPK lsUzsbKey = new UzsbPK();
    lsUzsbKey.setIdProject(idProject);
    lsUzsbKey.setIdUzsb(lsId);
    lsUzsb.setPk(lsUzsbKey);
    lsUzsb.setVerdeck(einVerdeck);
    Vector<Uzsb> uzsbColl = new Vector<Uzsb>();
    uzsbColl.add(lsUzsb);
    einVerdeck.setUzsbCollection(uzsbColl);
    em.persist(einVerdeck);
    As result I get the error
    "ORA-02291: integrity constraint (R57SCHRAUB.SYS_C0022330) violated - parent key not found"
    Does anybody have an idea? I think the problem could be the embedded key in Verdeck.
    Perhaps I should take this into account in my JPA-definition of the relationship?
    But how can I do this?
    Regards,
    Christoph

    Hi Christoph,
    our JPA implementation does not sort sqlstatements in the right order to work with foreign keys. This feature will come with the next release. The problem here is that databases check the constraint for every statement executed instead of checking at commit time (when our state is ok again).
    As workaround you can set the settings for the foreign key constraints to deferred (pls. see oracle docu: alter table defferrable / alter session deffered) and the database will check at commit time. Second approach would be to delete the foreign key constraints.
    hth
    -Andreas

  • SSRS 2008 - How to filter records from the many side base an specific criteria

    I have a report that displays a summary of all the actions taken for specific project, I need to restrict those records based one of those options from the left side table.  If case 1 was
    denied it should not show in the report.  I need help with this query
    Please Help me  Angie
    Ex:
    Project name
    Actions
    Case 1
    Received
    Process
    Sent for Modifications
    Received w/Modifications
    Denied
    Case 2
    Received
    Process
    Sent for Modifications
    Received w/Modifications
    APPROVED
    Case 3
    Received
    Process
    Sent for Modifications
    Received w/Modifications
    Inactive
    Project name
    Actions
    Case 1
    Received
    Angie

    Hi,
    You can set the Rowvisibility  of the detail row to hide based on the expression
    =IIF(Fields!Actions.Value="Denied",True,False)
    Many Thanks
    Chandra
    If this Answers your issue please mark as answered.

  • Help needed on Many to Many Parent Child Relationship (PL/SQL)

    Friends,
    Please help me.
    I have table where in two columns are having many to many parent child relation ship. It means child can have multiple parents.
    Table strucuture and sample records given below. Here 334059 is GRAND PARENT of all child records.
    PARENT     CHILD     LEVEL     Usage
    334059     380499     1     This Level has 2 childs
    334059     334730     1     
    334730     335629     2     This level too has 2 childs where in 380499 is child of 334730 & 334059 also.
    334730     380499     2     
    380499     380497     2     This level has 3 childs and 88888 is having further child.
    380499     334730     2     
    380499     88888     2     
    88888     99999     3     It has one child 99999 and has further child 10101.
    99999     10101     4     It has one child 10101 and has further child 11111.
    10101     11111     5     It has one child 11111 and has no further child. I.e leaf node.
    11111     0     6     leaf node
    What I want is records in same level above. I am using below code but its implementing only UPTO 2nd LEVEL given above.
    Further its not going i.e 3,4,5,6 level. Could you please help me?
    DECLARE
    CURSOR main_pc(p_child pc.child%type) IS
    SELECT CHILD
    FROM pc where parent = p_child;
    CURSOR main_dw(p_child dw_exrdbo.exr_parent_child.child_fund%type,
    p_level NUMBER) IS
    SELECT DISTINCT CHILD_FUND,LEVEL_NUMBER FROM dw_exrdbo.exr_parent_child
    where parent_fund = p_child
    and parent_fund <> child_fund
    and level_number = p_level;
    v_next_parent pc.child%type;
    v_level NUMBER := 1;
    v_grand_parent dw_exrdbo.exr_parent_child.parent_fund%type := 334059;
    v_parent dw_exrdbo.exr_parent_child.parent_fund%type;
    vDone BOOLEAN;
    v_xyz dw_exrdbo.exr_parent_child.parent_fund%type;
    v_cnt NUMBER := 0;
    BEGIN
    DELETE FROM dw_exrdbo.exr_parent_child;
    COMMIT;
    INSERT INTO dw_exrdbo.exr_parent_child
    SELECT PARENT, CHILD, 'INVONE', 12345, 'P',0,1
    FROM pc where parent = v_grand_parent
    AND NOT EXISTS (select 'x' from dw_exrdbo.exr_parent_child where parent_fund = v_grand_parent);
    COMMIT;
    FOR i IN (select distinct child FROM pc WHERE parent = v_grand_parent) --334059
    LOOP
    DBMS_OUTPUT.PUT_LINE('Next Parent is '||v_parent);
    FOR x IN main_pc(i.child)
    LOOP
    INSERT INTO dw_exrdbo.exr_parent_child
    (parent_fund, child_fund, source_application, valuation_date_sid, parent_child_flag, child_count, level_number)
    VALUES(i.child, X.CHILD, 'INVONE', 12345, 'C',0,1+1);
    COMMIT;
    END LOOP;
    END LOOP;
    END;
    Thanks in advance!!!
    Regards,
    Jigger

    Hi, Jigger,
    Sorry, I can't tell what you want.
    Whenever you have a question, please post CREATE TABLE and INSERT statements for your sample data, and the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using.

  • Foreign key in many to one relationship causes redunency

    Hi
    suppose I have two tables
    A and B
    Table A has a primary key A_PK number
    Table B has a primary key B_PK number
    The relation between two tables is M to One
    if B_PK is foreign key on table A
    then it causes redunency
    A_PK B_PK
    1 1
    2 1
    so what the best way to solve like this problem?
    thanks

    VANPERSIE wrote:
    Hi
    suppose I have two tables
    A and B
    Table A has a primary key A_PK number
    Table B has a primary key B_PK number
    The relation between two tables is M to One
    if B_PK is foreign key on table A
    then it causes redunency
    A_PK B_PK
    1 1
    2 1
    so what the best way to solve like this problem?
    thanksIt's not sure from your description exactly how/where/what columns are involved in the FK relationship. You either have no problem, or your problem is that you have two tables with the same PK, meaning you haven't normalized your design.
    As suggested, post actual table defs, not just a vague description.

  • Need an approach regarding reporting for a one-to-many primary-child relationship, where there are more than three child objects for a primary object for reporting purpose

    Business Scenario- We have a parent organization with 6 different Business Units.One BU requires 9 stages for for Opportunity(Tender) Tracking.The client requirement is to show the basic details of the tender at the header level and to show details specific to individual sales stage as different tabs.There will be multiple opportunity members added as opportunity team and will be responsible for capturing details specific to individual sales stage(tab). The Tab should be enabled and disabled based on the role. Reporting is required against each stage with specific fields of child objects against each opportunity.
    We created multiple children entities under the oportunity(one to many mapping) but we are unable to add more than 3 child objects for a primary object for reporting purpose.
    Kindly suggest what needs to be done to meet the requirement

    Can you provide the exact steps you took to  "created multiple children entities under the oportunity" ?
    Jani Rautiainen
    Fusion Applications Developer Relations
    https://blogs.oracle.com/fadevrel/

  • EF6 Code First: Many to Many Self referencing relationship

    Hi,
    Could any one show me an example for many to many self referencing?
    The scenario is that I have a user table that will contains collection of users as friends.
    Thanks,
    Bo

    Hi Kalman,
    Really appreciate your answer.
    I just wonder if I can, alternatively, set up tables as below,
    Public class user
    public int userId{get; set;}
        public
    virtual
    ICollection<User> CircleOneFriends { get; set; }
        public virtual ICollection<User>
    CircleTwoFriends { get; set; }
       public User()
    CircleOneFriends
    = new HashSet<User>();
    CircleTwoFriends = new HashSet<User>();
    public class UserConfiguration : EntityTypeConfiguration<User>
        public
    UserConfiguration()
           this.HasMany(x=>x.CircleOneFriends) .WithMany(x=>x.CircleTwoFriends).Map(x=>x.ToTable("Friends"))
    Do you think that will work in my case?
    Thanks a lot,
    Bo

  • Many to one relationship !

    Hi All,
    i have one query having Rental Unit and Measurements.
    in reality one Rental unit has many measurements but when i run the query it shows me only one measurements per Rental Until!
    any clue ? how can i get all the measurements for each rental unit ?
    please help.

    in the cube do you have both of these values
    PT02 211886
    PT02 211887
    or its always either one of them. I dont think changing your cube design would prove any helpful in this scenario. I believe its more of a data issue than the design issue. You would need to change the way the data is entered into the cube with the different measurement assigned to the unit.
    on a second thought(I understand that you dont have a luxury to change the cube design),  when you say you can see diff measurement type assigned to one unit in the masterdata, you can make the unit attribute as a navigational attribute in both the IO and cube. And just map measurent type in the update rules and derive the units from the masterdata table in the report.... does it make sense?
    Message was edited by:
            voodi

Maybe you are looking for