[CDO] Issue with Maps [message #985949] |
Fri, 16 November 2012 20:18 |
Ray Braithwood Messages: 5 Registered: November 2012 |
Junior Member |
|
|
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).
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
|
|
|
Re: [CDO] Issue with Maps [message #985993 is a reply to message #985949] |
Sat, 17 November 2012 04:27 |
|
Am 16.11.2012 21:18, schrieb Ray Braithwood:
> 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.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Powered by
FUDForum. Page generated in 0.04038 seconds