Many-to-Many mapping is not working as expected

I have two tables USERS(PK: User Id) and TEAMS(PK is Team Id. We have an intermediate table MEMBERSHIP that has two columns (User Id, Team Id) and maintains the relation between Users and Teams.
When we add team A to user ' B' the table(MEMBERSHIP) is updated as expected.
When I retrieve the teams for user B. the team A is part of the list.
But when I get the users for team A, the user B is not part of the list.
If we again try to add user B to team A, we get a unique constraint violation as expected.
Could anyone help resolve this issue?
We have created the below 2 mappings:
1. Users and Teams - > where we have to add teams to the user
<mapping>
<inherited>false</inherited>
<instance-variable-name>teams</instance-variable-name>
<uses-method-accessing>false</uses-method-accessing>
<read-only>false</read-only>
<get-method-handle>
<method-handle empty-aggregate="true"/>
</get-method-handle>
<set-method-handle>
<method-handle empty-aggregate="true"/>
</set-method-handle>
<reference-descriptor>com.pkg.Team.ClassDescriptor</reference-descriptor>
<private-owned>false</private-owned>
<uses-batch-reading>false</uses-batch-reading>
<table-reference-mapping-reference-handle>
<reference-handle>
<reference-table>MEMBERSHIP</reference-table>
<reference-name>MEMBERSHIP_USERS</reference-name>
</reference-handle>
</table-reference-mapping-reference-handle>
<container-type>Collection</container-type>
<uses-default-container-class>true</uses-default-container-class>
<key-method>
<method-handle empty-aggregate="true"/>
</key-method>
<collection-mapping-indirection-policy>
<collection-indirection-policy>
<uses-indirection>false</uses-indirection>
<uses-transparent-indirection>false</uses-transparent-indirection>
</collection-indirection-policy>
</collection-mapping-indirection-policy>
<ordering-criteria>
<collection-ordering-criteria>
<use-ordering>false</use-ordering>
<ascending>true</ascending>
</collection-ordering-criteria>
</ordering-criteria>
<relation-table>MEMBERSHIP</relation-table>
<target-reference-handle>
<reference-handle>
<reference-table>MEMBERSHIP</reference-table>
<reference-name>MEMBERSHIP_TEAMS</reference-name>
</reference-handle>
</target-reference-handle>
<mapping-class>MWManyToManyMapping</mapping-class>
</mapping>
2. Teams to User -> where we have to add users to the team
<mapping>
<inherited>false</inherited>
<instance-variable-name>users</instance-variable-name>
<uses-method-accessing>false</uses-method-accessing>
<read-only>false</read-only>
<get-method-handle>
<method-handle empty-aggregate="true"/>
</get-method-handle>
<set-method-handle>
<method-handle empty-aggregate="true"/>
</set-method-handle>
<reference-descriptor>com.pkg.User.ClassDescriptor</reference-descriptor>
<private-owned>false</private-owned>
<uses-batch-reading>false</uses-batch-reading>
<table-reference-mapping-reference-handle>
<reference-handle>
<reference-table>MEMBERSHIP</reference-table>
<reference-name>MEMBERSHIP_TEAMS</reference-name>
</reference-handle>
</table-reference-mapping-reference-handle>
<container-type>Collection</container-type>
<uses-default-container-class>true</uses-default-container-class>
<key-method>
<method-handle empty-aggregate="true"/>
</key-method>
<collection-mapping-indirection-policy>
<collection-indirection-policy>
<uses-indirection>true</uses-indirection>
<uses-transparent-indirection>false</uses-transparent-indirection>
</collection-indirection-policy>
</collection-mapping-indirection-policy>
<ordering-criteria>
<collection-ordering-criteria>
<use-ordering>false</use-ordering>
<ascending>true</ascending>
</collection-ordering-criteria>
</ordering-criteria>
<relation-table>MEMBERSHIP</relation-table>
<target-reference-handle>
<reference-handle>
<reference-table>MEMBERSHIP</reference-table>
<reference-name>MEMBERSHIP_USERS</reference-name>
</reference-handle>
</target-reference-handle>
<mapping-class>MWManyToManyMapping</mapping-class>
</mapping>

Hi Chris,
Thank you so much for inputs/updates.
"You must put A in B's collection of A's and also put B in A's collection of Bs" we are already handling this in our code.
As per your suggestion i have used refreshIdentityMapResult() method and read only option, after that i m able to see User B in team A.
ReadAllQuery findById = ..
findById.refreshIdentityMapResult();
But if try to remove team A from user ' B' and add same team A to user B then user B is not updating with team A. Please let me know if m missing any mapping/configurations.
Regards
Chandra

Similar Messages

  • Many to Many relatiohship is not working

    Hi
    I am having Designer 6i version 6.5.96.5.6 downloaded from oracle site.
    We got LDM (Logical Data Model) dump from client site and successfully imported into my server. But while generating LDM to PDM many to many relaships are not working. If i select the many to many relatiships alone then they are working. But if i select all the elements in the ERD its not working.
    If any body having the solution please help me.

    Could you specify what it means when you say it is not working? What happens or what does not happen what you would expect to happen? Does the system give you any comments or errors?
    -v-

  • When i install the new os my fcp,motion and many adobe software not working so please help me out.

    when i install the new os my fcp,motion and many adobe software not working so please help me out.
    there are so many videos on youtube but i want know any solution from apple side plz my so many works are pending becuze i am working as Video Editor.

    You need to be more specific about which software applications you're using, the versions and what happens when you try to open them.
    It would also be nice if you could include which model MacBook Air you're using.
    Clinton
    MacBook Pro (15” Late 2011), OS X Yosemite 10.10, 16GB Crucial RAM, 960GB M500 Crucial SSD, 27” Apple Thunderbolt Display

  • I m using apple mac pc, when we start windows 7 , apple mouse doesn't work properly it take to much time to gain signals from the pc and many times it not work but when we use mac it moves fastly and works properly. please suggest me. thanks ravi

    i m using apple mac pc, when we start windows 7 , apple mouse doesn't work properly it take to much time to gain signals from the pc and many times it not work but when we use mac it moves fastly and works properly. please suggest me.
    thanks
    ravi
    <Email removed by Host>                                                                                                                                                                                                                                       

    sounds more like Bluetooth rather than moue, but w/o knowing w/o posting mac model type/year we... will... not... know... what you have
    All computers are personal computers, a PC though is also "non-Apple" in common usage.
    Mac also is platform and OS.
    Very confused reading what you are trying to tell us.

  • Hi, i need ur help. i got my ipad from my school and they formatted it so that many things would not work, one of those things was iCloud, could any of you please help me undo that?

    hi, i need ur help. i got my ipad from my school and they formatted it so that many things would not work, one of those things was iCloud, could any of you please help me undo that?

    Check the settings on your iPad:
    1. "Settings > General > Restrictions"
    and also
    2.  "Settings > General > Accessibility" here Learning/Guided Access

  • I just installed new new version of lion and many programs do not work?

    I just installed the new version of lion and many programs do not work

    tfreers wrote:
    I just installed the new version of lion and many programs do not work
    Such as? No PPC programs will work. That has been well known for over six months as Rosetta was finally droped after the phasing out of PPC program support over the last 5 to 6 years.
    Cheers

  • Is it possible to  downgrade ios 6 to 5.1.1(i upgrade my iphone 4s from 5.1.1 to 6 but map is not working )

    is it possible to  downgrade ios 6 to 5.1.1(i upgrade my iphone 4s from 5.1.1 to 6 but map is not working )

    best answer to your question I've ever seen is;
    Kappy Tampa, FL and Vancouver, BC
    Re: Downgrading     Oct 16, 2012 2:57 PM    (in response to nbabbit2013) 
    I'm sorry, but Apple does not provide a downgrade path for iOS. Because downgrading is unsupported by Apple we cannot discuss it on these forums, but you can use Google to find information on how to install an older version of iOS on any iDevice.

  • In my MacBook Pro Maps app not working properly?.. any solution

    Maps app not working properly?.. any solution

    If i search any routes by clicking directions tab,the message shows like this " DIRECTIONS ARE NOT AVAILABLE A ROUTE TO THE DESTINATION FROM ITS NEAREST ROAD CANNOT BE DETERMINED"

  • The application maps is not working. When I try to run it opens for a few seconds with a blank screen and then closes

    The application maps is not working. When I try to run it opens for a few seconds with a blank screen and then closes.

    Try a reset by pressing the home and sleep buttons until you see the Apple logo, ignoring the slider. Takes about 5-15 secs of button holding and you won't lose any data or settings.

  • Input Parameter Mapping is not working in Sap HANA

    Hi, We created on ANALYTICAL view(A) with Input Parameters, on top of Analytical view created one Calculation view(B) and mapped Calculation view input parameter with Analytical view input paramter and its working fine. Finally we created one more calculation view on top existing calculation view(B) and mapped with corresponding input parameters. Input parameter mapping is working fine in between A(analytical view) and --------> B (first Calc view) but input parameter mapping is not working properly in between B(first Calc View)-----------C(second Calc View). it is giving all data whatever is coming from Calc View B. Kindly help us to resolve this.

    Hi,
    Write c in small for Command,
    theButton.mappingOfOnAction().addParameter("command","Save");
    Regards,
    Murtuza

  • Maps is not working properly anymore

    I am using iPad2 with iOS6 and since a few days Maps is not working properly anymore

    I'm having the same problem. I have a 4th gen 32GB iPod Touch, and since upgrading to iOS6, iMessage has been nothing but buggy. It will work for an hour or so, and then randomly stop working as it won't send or receive messages. There's nothing wrong with my wifi, because that's the same as it was before. I really hope someone knows something to fox this problem. Some people use iMessage for good reasons - it needs to be a reliable messaging service like it was in iOS5.

  • After installing iOS6, my Maps are not working at all, anything i search it says "result not found" even after placing a pin and selecting "Direction to here" i get the same result not found. Very disappointed with the new iOS

    After installing iOS6, my Maps are not working at all, anything i search it says "result not found" even after placing a pin and selecting "Direction to here" i get the same result not found. Very disappointed with the new iOS.

    Have you run it in a debugger? That will show you exactly what is happening and why.

  • Maps app not working on Network Users

    Maps app not working on network users on client machines?, is everyone having same issue?, Thanks in Advance

    Sometimes it does, sometimes it does not. I assume we're talking about network users with home folders on a remote volume…
    The only thing I could do about it was to inform Apple…

  • Maps are not working in India after updating to iOS 6

    I bought my iPhone 4S from USA now I am in India and I updated to iOS 6 but now maps are not working.. Earlier it use to search every single place in india.. What to do??

    me too stuck up with the iOS 6 update. I was using my phone mainly for tracking roads and places. Now its useless. So guys if u r using iOS 5.1 in India dont update to iOS 6.Moreover i cant find google maps app in Appstore! can anyone find me a solution?

  • I have iPhone4 with updated software 6.0.1. Voice nevigation for map is not working. I could not see the voice options in setting/mapp.

    I have iPhone4 with updated software 6.0.1. Voice nevigation for map is not working. I could not see the voice options in setting/mapp.

    Voice navigation is not available for the iPhone 4

Maybe you are looking for

  • Some USBs don't appear in Finder. They appear in Disk Utilities so how do I get them to appear in Finder?

    Some flash drives/USBs don't appear in Finder. But they appear in Disk Utilities so how do I get them to appear in Finder?

  • Very basic questions

    Currently for live performance I use my Nord Stage 2 and an iPad Air running an app called SetListMaker. The app displays my sets and when I click the next song, it sends a patch change to my Nord for that song. I use an iRig MIDI 2 as the interface.

  • How to remove switches from a fabric.

    We have a couple of MDS9120's and a SUP1 9509 in our fabric that we want to retire.   I'm pretty sure that I don't want to just shut down these switches, unplug the cables and call it good.   Also the 9509 is the principal for two of our larger VSAN'

  • Expiry-delay: how to evict an entry without "touching" it?

    I have a cache (called pending mutation cache) with an expiry-delay set to 30 seconds and a listener (com.tangosol.net.events.EventInterceptor, EntryEvent.Type.REMOVED) configured on the same cache. The objective: when an entry is evicted, the event

  • Reg:fragmentation in OBIEE

    Hi All, I query, we are trying to use Aggregate tables in our design by Materialized views as option. When we want to use these MVs should these MVs not contain any operators like MINUS, UNION ALL etc? Does OBIEE support fragmentation?? Any pointers