Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Issue with Maps
[CDO] Issue with Maps [message #985949] Fri, 16 November 2012 15:18 Go to next message
Ray Braithwood is currently offline 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] Fri, 16 November 2012 23:27 Go to previous message
Eike Stepper is currently offline Eike Stepper
Messages: 5483
Registered: July 2009
Senior Member
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
Previous Topic:[CDO] Rollback problem
Next Topic:[ANN]: Code Generation 2013 Call for Speakers now open
Goto Forum:
  


Current Time: Mon Jul 28 10:28:02 EDT 2014

Powered by FUDForum. Page generated in 0.03705 seconds