Can't access objects in dictionary
Amir Ansari
fractallyte at csi.com
Thu Dec 30 13:24:51 UTC 2010
I enter the following code in a Workspace:
(the class 'User' is just a very simple class with instance variable 'username' and corresponding accessors)
MagmaRepositoryController create: '/testDB' root: Dictionary new.
initialSession := MagmaSession openLocal: '/testDB'.
initialSession connectAs: 'admin'.
initialSession commit: [ initialSession root at: 'users' put: MagmaPreallocatedDictionary new ].
initialSession disconnect; closeRepository.
newUser := User new username: 'Charlie'; yourself.
newSession := MagmaSession openLocal: '/testDB'.
newSession connectAs: 'charlie'.
newSession commit: [ (newSession root at: 'users') at: newUser put: OrderedCollection new ].
newSession disconnect; closeRepository.
testSession := MagmaSession openLocal: '/testDB'.
testSession connectAs: 'aUser'.
(testSession root at: 'users') size
(testSession root at: 'users') at: newUser
The last two lines indicate the problem: the size of the MagmaPreallocatedDictionary is reported correctly (even when I add more users), but when I try to access any of the entries with the 'User' objects as keys, I get a 'errorKeyNotFound:' error.
Am I doing something wrong...?
Amir
More information about the Magma
mailing list