|[CDO] Issue with Maps [message #985949]
||Fri, 16 November 2012 15:18
| Ray Braithwood
Registered: November 2012
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).
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.
Thanks for your help