[CDO] Issue with Mapshttps://www.eclipse.org/forums/index.php/mv/msg/440249/985949/#msg_985949
I am currently trying to model a Map in CDO and have an interesting issue wrt retrieval from the Map. Basically the map returns null when I use Map.get(..) if the map owner is persisted until I commit the newly added item -and- I reload the owner from the DB (for me, that is a restart of the application).

When I use this, I cannot successfully retrieve the items until, as mentioned above, I commit to the DB and restart my application. The funny thing is if I use Map.put(..) everything works fine. I can also iterate through the List of entries to find the new items so they are in the list.

I did dig a little into the CDO Map impl and it looks like when adding from the command, something is not putting the new item into the correct hash bucket. That said, I am willing to believe I did something wrong since I am new to CDO but following the code it looks like there is a CDO bug. I have also looked at the test cases you have and it appears you do not have any tests that add to a Map using commands.

Thanks for your help
]]>Ray Braithwood2012-11-16T20:18:09-00:00Re: [CDO] Issue with Mapshttps://www.eclipse.org/forums/index.php/mv/msg/440249/985993/#msg_985993
> Hi,
>
> I am currently trying to model a Map in CDO and have an interesting issue wrt retrieval from the Map. Basically the
> map returns null when I use Map.get(..) if the map owner is persisted until I commit the newly added item -and- I
> reload the owner from the DB (for me, that is a restart of the application).
Too many conditions in that sentence for me to understand what you're really trying to do :P

> I am adding items to the map using commands.
> EObject entry = Factory.eINSTANCE.create(Package.eINSTANCE.getMapEntry());
> command.append(AddCommand.create(domain, getManager(), Package.eINSTANCE.getManager_Map(), entry));
> command.append(SetCommand.create(domain, entry, Package.eINSTANCE.getMapEntry_Key(), key));
> command.append(SetCommand.create(domain, entry, Package.eINSTANCE.getMapEntry_Value(), value));
>
>
> When I use this, I cannot successfully retrieve the items until, as mentioned above, I commit to the DB and restart my
> application. The funny thing is if I use Map.put(..) everything works fine. I can also iterate through the List of
> entries to find the new items so they are in the list.
>
> I did dig a little into the CDO Map impl and it looks like when adding from the command, something is not putting the
> new item into the correct hash bucket. That said, I am willing to believe I did something wrong since I am new to CDO
> but following the code it looks like there is a CDO bug. I have also looked at the test cases you have and it appears
> you do not have any tests that add to a Map using commands.
I think it's best that you copy one of our many test cases and change it to reproduce your problem. If you can do that,
please submit a bugzilla with that code attached and I can quickly analyze it for you.