---------- Forwarded message ---------- From: Andrés Garagiola <[hidden email]> Date: 2010/3/18 Subject: Duplicate objects with same primary key To: [hidden email] Hi list, I wrote the following test: resources loginDuring: [ :session | | peter users | peter := session readOneOf: User where: [ :user | user userID = 'peter' ]. self assert: peter notNil. self assert: peter role notNil. self assert: peter role name = 'trader' . session inUnitOfWorkDo: [ session register: peter. peter role: (session readOneOf: RoleBehavior where: [ :role | role name = 'trader' ]) ]. self assert: peter role name = 'trader'. session inUnitOfWorkDo: [ session register: peter. peter name: 'peter other'. peter role: (session readOneOf: RoleBehavior where: [ :role | role name = 'trader' ]) ]. self assert: peter role name = 'trader'. users := session readManyOf: User. self assert: users notNil. self assert: users notEmpty ] User have a OneToOneMapping with the role class. In boths unit of work, i sent the same role to the user (bold font), and in the second unit of work an execption is raised "Duplicate objects with same primary key". The session have two instance of the role "trader", the instance previously cached and the recent read instance. Anybody know what´s the problem here? attach the stack Thanks Duplicate objects with same primary key Glorp.DuplicatePrimaryKeyException(Glorp.GlorpError)>>signal Glorp.Cache>>includesKey:as: Glorp.CacheManager>>containsObject:key: IpsGSG.GlorpSession(Glorp.GlorpSession)>>cacheContainsObject:key: optimized [] in Glorp.GlorpSession>>isNew: BlockClosure>>on:do: IpsGSG.GlorpSession(Glorp.GlorpSession)>>isNew: IpsGSG.GlorpSession(Glorp.GlorpSession)>>register: optimized [] in Glorp.UnitOfWork>>registerTransitiveClosureFrom: optimized [] in [] in Glorp.Descriptor>>referencedIndependentObjectsFrom:do: Array(SequenceableCollection)>>do: optimized [] in Glorp.Descriptor>>referencedIndependentObjectsFrom:do: Array(SequenceableCollection)>>do: IpsGSG.Descriptor(Glorp.Descriptor)>>referencedIndependentObjectsFrom:do: Glorp.UnitOfWork>>registerTransitiveClosureFrom: Glorp.UnitOfWork>>register: IpsGSG.GlorpSession(Glorp.GlorpSession)>>register: optimized [] in [] in IpsGSGTest.ChangeUserRoleUserStoryTest>>testChangeRole optimized [] in Glorp.GlorpSession>>inUnitOfWorkDo: BlockClosure>>ifCurtailed: IpsGSG.GlorpSession(Glorp.GlorpSession)>>inUnitOfWorkDo: optimized [] in IpsGSGTest.ChangeUserRoleUserStoryTest>>testChangeRole optimized [] in IpsGSGTest.UserStoryTestResource>>loginDuring: BlockClosure>>ensure: IpsGSGTest.UserStoryTestResource>>loginDuring: IpsGSGTest.ChangeUserRoleUserStoryTest>>testChangeRole IpsGSGTest.ChangeUserRoleUserStoryTest(SUnit.TestCase)>>performTest optimized [] in SUnit.TestCase>>doTestCycle BlockClosure>>ensure: IpsGSGTest.ChangeUserRoleUserStoryTest(SUnit.TestCase)>>doTestCycle optimized [] in SUnit.TestCase>>run BlockClosure>>on:do: IpsGSGTest.ChangeUserRoleUserStoryTest(SUnit.TestCase)>>run IpsGSGTest.ChangeUserRoleUserStoryTest(SUnit.TestCase)>>debug optimized [] in Refactory.Browser.SUnitTooMiniBar>>debug: BlockClosure>>ensure: Refactory.Browser.SUnitTooMiniBar>>debug: optimized [] in Refactory.Browser.SUnitTooMiniBar>>debugTests optimized [] in [] in [] in [] in [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: UndefinedObject>>ifNil: optimized [] in [] in [] in [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: optimized [] in SUnit.TestSuite>>testCasesFrom:randomDo: Array(SequenceableCollection)>>do: SUnit.TestSuite>>testCasesFrom:randomDo: SUnit.TestSuite>>testCasesFrom:do: optimized [] in [] in SUnit.TestSuite>>runUsing: Dictionary>>keysAndValuesDo: optimized [] in SUnit.TestSuite>>runUsing: BlockClosure>>ensure: SUnit.Results>>collectWhile: SUnit.Results class>>collectWhile: SUnit.TestSuite>>runUsing: optimized [] in [] in [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: BlockClosure>>on:do: optimized [] in [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: BlockClosure>>ensure: SUnit.Results>>collectWhile: optimized [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: BlockClosure>>on:do: optimized [] in Process class>>forBlock:priority: ---------------------------------------------------------------------- Glorp.DuplicatePrimaryKeyException(Glorp.GlorpError)>>signal Receiver: a Glorp.DuplicatePrimaryKeyException Instance Variables: messageText = 'Duplicate objects with same primary key' originator = a Glorp.DuplicatePrimaryKeyException initialContext = Glorp.DuplicatePrimaryKeyException(Glorp.GlorpError)>>signal firstUnwindContext = BlockClosure>>ifCurtailed: handlerContext = BlockClosure>>on:do: parameter = nil proceedBlock = nil isResumable = false signal = nil searchContext = IpsGSG.GlorpSession(Glorp.GlorpSession)>>isNew: existingObject = (Composite Role) trader newObject = (Composite Role) trader Context PC = 7 ---------------------------------------------------------------------- Glorp.Cache>>includesKey:as: Receiver: a Glorp.Cache Instance Variables: items = an EphemeralValueDictionary[2] policy = a Glorp.WeakVWCachePolicy mainCache = a Glorp.CacheManager extraReferences = a Glorp.FixedSizeQueue(6/100) Arguments: key = 16 anObject = (Composite Role) trader Temporaries: item = (Composite Role) trader value = (Composite Role) trader Context PC = 22 ---------------------------------------------------------------------- Glorp.CacheManager>>containsObject:key: Receiver: a Glorp.CacheManager Instance Variables: subCaches = an IdentityDictionary[3] session = an IpsGSG.GlorpSession Arguments: anObject = (Composite Role) trader aKey = 16 Temporaries: cache = a Glorp.Cache Context PC = 11 ---------------------------------------------------------------------- IpsGSG.GlorpSession(Glorp.GlorpSession)>>cacheContainsObject:key: Receiver: a IpsGSG.GlorpSession Instance Variables: system = an IpsSIIF2.SIIF2DescriptorSystem currentUnitOfWork = a Glorp.UnitOfWork cache = a Glorp.CacheManager accessor = a Glorp.VWDatabaseAccessor applicationData = nil reaper = nil errorAction = nil modificationTracker = nil Arguments: anObject = (Composite Role) trader aKey = 16 Context PC = 9 ---------------------------------------------------------------------- optimized [] in Glorp.GlorpSession>>isNew: Receiver: an UndefinedObject Temporaries: .self = an IpsGSG.GlorpSession .anObject = (Composite Role) trader .key = 16 Context PC = 8 ---------------------------------------------------------------------- BlockClosure>>on:do: Receiver: a BlockClosure Instance Variables: method = CompiledBlock [] in Glorp.GlorpSession>>isNew: outerContext = nil copiedValues = an Array[3] Arguments: anExceptionSelector = Glorp.DuplicatePrimaryKeyException handlerBlock = BlockClosure [] in Glorp.GlorpSession>>isNew: Context PC = 18 ---------------------------------------------------------------------- IpsGSG.GlorpSession(Glorp.GlorpSession)>>isNew: Receiver: a IpsGSG.GlorpSession Instance Variables: system = an IpsSIIF2.SIIF2DescriptorSystem currentUnitOfWork = a Glorp.UnitOfWork cache = a Glorp.CacheManager accessor = a Glorp.VWDatabaseAccessor applicationData = nil reaper = nil errorAction = nil modificationTracker = nil Arguments: anObject = (Composite Role) trader Temporaries: key = 16 descriptor = an IpsGSG.Descriptor(IpsGSG.CompositeRole) Context PC = 51 ---------------------------------------------------------------------- IpsGSG.GlorpSession(Glorp.GlorpSession)>>register: Receiver: a IpsGSG.GlorpSession Instance Variables: system = an IpsSIIF2.SIIF2DescriptorSystem currentUnitOfWork = a Glorp.UnitOfWork cache = a Glorp.CacheManager accessor = a Glorp.VWDatabaseAccessor applicationData = nil reaper = nil errorAction = nil modificationTracker = nil Arguments: anObject = (Composite Role) trader Temporaries: realObject = (Composite Role) trader Context PC = 18 ---------------------------------------------------------------------- optimized [] in Glorp.UnitOfWork>>registerTransitiveClosureFrom: Receiver: an UndefinedObject Arguments: eachObject = (Composite Role) trader Temporaries: .self = a Glorp.UnitOfWork Context PC = 7 ---------------------------------------------------------------------- optimized [] in [] in Glorp.Descriptor>>referencedIndependentObjectsFrom:do: Receiver: an UndefinedObject Arguments: eachReferencedObject = (Composite Role) trader Temporaries: .aBlock = BlockClosure [] in Glorp.UnitOfWork>>registerTransitiveClosureFrom: Context PC = 6 ---------------------------------------------------------------------- Array(SequenceableCollection)>>do: Receiver: an Array Arguments: aBlock = BlockClosure [] in [] in Glorp.Descriptor>>referencedIndependentObjectsFrom:do: Temporaries: i = 1 Context PC = 19 ---------------------------------------------------------------------- optimized [] in Glorp.Descriptor>>referencedIndependentObjectsFrom:do: Receiver: an UndefinedObject Arguments: each = a Glorp.OneToOneMapping(role) Temporaries: .anObject = Pedro Duque (peter) .aBlock = BlockClosure [] in Glorp.UnitOfWork>>registerTransitiveClosureFrom: Context PC = 12 ---------------------------------------------------------------------- Array(SequenceableCollection)>>do: Receiver: an Array Arguments: aBlock = BlockClosure [] in Glorp.Descriptor>>referencedIndependentObjectsFrom:do: Temporaries: i = 5 Context PC = 19 ---------------------------------------------------------------------- IpsGSG.Descriptor(Glorp.Descriptor)>>referencedIndependentObjectsFrom:do: Receiver: a IpsGSG.Descriptor Instance Variables: tables = an OrderedCollection[1] mappings = an Array[7] system = an IpsSIIF2.SIIF2DescriptorSystem mappedFields = an OrderedCollection[6] cachePolicy = nil typeResolver = a Glorp.IdentityTypeResolver mapsPrimaryKeys = true keyFields = nil classModel = ~~User~~ multipleTableJoin = an OrderedCollection[0] imaginaryTableReplacements = nil mappingsForFields = an IdentityDictionary[6] Arguments: anObject = Pedro Duque (peter) aBlock = BlockClosure [] in Glorp.UnitOfWork>>registerTransitiveClosureFrom: Context PC = 9 ---------------------------------------------------------------------- Glorp.UnitOfWork>>registerTransitiveClosureFrom: Receiver: an Glorp.UnitOfWork Instance Variables: session = an IpsGSG.GlorpSession transaction = a Glorp.ObjectTransaction deletedObjects = an IdentitySet[0] newObjects = an IdentitySet[0] rowMap = a Glorp.RowMap commitPlan = an OrderedCollection[0] deletePlan = an OrderedCollection[0] rowsByTable = nil succeeded = nil linkRowsForUpdate = nil commitPhase = nil deleting = an IdentitySet[0] Arguments: anObject = Pedro Duque (peter) Temporaries: descriptor = an IpsGSG.Descriptor(IpsGSG.User) Context PC = 39 ---------------------------------------------------------------------- Glorp.UnitOfWork>>register: Receiver: an Glorp.UnitOfWork Instance Variables: session = an IpsGSG.GlorpSession transaction = a Glorp.ObjectTransaction deletedObjects = an IdentitySet[0] newObjects = an IdentitySet[0] rowMap = a Glorp.RowMap commitPlan = an OrderedCollection[0] deletePlan = an OrderedCollection[0] rowsByTable = nil succeeded = nil linkRowsForUpdate = nil commitPhase = nil deleting = an IdentitySet[0] Arguments: anObject = Pedro Duque (peter) Temporaries: realObject = Pedro Duque (peter) Context PC = 17 ---------------------------------------------------------------------- IpsGSG.GlorpSession(Glorp.GlorpSession)>>register: Receiver: a IpsGSG.GlorpSession Instance Variables: system = an IpsSIIF2.SIIF2DescriptorSystem currentUnitOfWork = a Glorp.UnitOfWork cache = a Glorp.CacheManager accessor = a Glorp.VWDatabaseAccessor applicationData = nil reaper = nil errorAction = nil modificationTracker = nil Arguments: anObject = Pedro Duque (peter) Temporaries: realObject = Pedro Duque (peter) Context PC = 27 ---------------------------------------------------------------------- optimized [] in [] in IpsGSGTest.ChangeUserRoleUserStoryTest>>testChangeRole Receiver: an UndefinedObject Temporaries: .session = an IpsGSG.GlorpSession .peter = Pedro Duque (peter) Context PC = 6 ---------------------------------------------------------------------- optimized [] in Glorp.GlorpSession>>inUnitOfWorkDo: Receiver: an UndefinedObject Temporaries: .self = an IpsGSG.GlorpSession result = nil myUnitOfWork = true .aBlock = BlockClosure [] in [] in IpsGSGTest.ChangeUserRoleUserStoryTest>>testChangeRole Context PC = 28 ---------------------------------------------------------------------- BlockClosure>>ifCurtailed: Receiver: a BlockClosure Instance Variables: method = CompiledBlock [] in Glorp.GlorpSession>>inUnitOfWorkDo: outerContext = nil copiedValues = an Array[3] Arguments: terminationBlock = BlockClosure [] in Glorp.GlorpSession>>inUnitOfWorkDo: Context PC = 4 ---------------------------------------------------------------------- IpsGSG.GlorpSession(Glorp.GlorpSession)>>inUnitOfWorkDo: Receiver: a IpsGSG.GlorpSession Instance Variables: system = an IpsSIIF2.SIIF2DescriptorSystem currentUnitOfWork = a Glorp.UnitOfWork cache = a Glorp.CacheManager accessor = a Glorp.VWDatabaseAccessor applicationData = nil reaper = nil errorAction = nil modificationTracker = nil Arguments: aBlock = BlockClosure [] in [] in IpsGSGTest.ChangeUserRoleUserStoryTest>>testChangeRole Temporaries: result = nil myUnitOfWork = true Context PC = 17 ---------------------------------------------------------------------- optimized [] in IpsGSGTest.ChangeUserRoleUserStoryTest>>testChangeRole Receiver: an UndefinedObject Arguments: session = an IpsGSG.GlorpSession Temporaries: peter = Pedro Duque (peter) users = nil .self = an IpsGSGTest.ChangeUserRoleUserStoryTest Context PC = 71 ---------------------------------------------------------------------- optimized [] in IpsGSGTest.UserStoryTestResource>>loginDuring: Receiver: an UndefinedObject Temporaries: .session = an IpsGSG.GlorpSession .aBlock = BlockClosure [] in IpsGSGTest.ChangeUserRoleUserStoryTest>>testChangeRole Context PC = 8 ---------------------------------------------------------------------- BlockClosure>>ensure: Receiver: a BlockClosure Instance Variables: method = CompiledBlock [] in IpsGSGTest.UserStoryTestResource>>loginDuring: outerContext = nil copiedValues = an Array[2] Arguments: aBlock = BlockClosure [] in IpsGSGTest.UserStoryTestResource>>loginDuring: Temporaries: result = nil Context PC = 4 ---------------------------------------------------------------------- IpsGSGTest.UserStoryTestResource>>loginDuring: Receiver: an IpsGSGTest.UserStoryTestResource Instance Variables: logging = true Arguments: aBlock = BlockClosure [] in IpsGSGTest.ChangeUserRoleUserStoryTest>>testChangeRole Temporaries: session = an IpsGSG.GlorpSession Context PC = 16 ---------------------------------------------------------------------- IpsGSGTest.ChangeUserRoleUserStoryTest>>testChangeRole Receiver: a IpsGSGTest.ChangeUserRoleUserStoryTest Instance Variables: testSelector = #testChangeRole resources = an IpsGSGTest.UserStoryTestResource Context PC = 7 ---------------------------------------------------------------------- IpsGSGTest.ChangeUserRoleUserStoryTest(SUnit.TestCase)>>performTest Receiver: a IpsGSGTest.ChangeUserRoleUserStoryTest Instance Variables: testSelector = #testChangeRole resources = an IpsGSGTest.UserStoryTestResource Context PC = 5 ---------------------------------------------------------------------- optimized [] in SUnit.TestCase>>doTestCycle Receiver: an UndefinedObject Temporaries: .self = an IpsGSGTest.ChangeUserRoleUserStoryTest Context PC = 9 ---------------------------------------------------------------------- BlockClosure>>ensure: Receiver: a BlockClosure Instance Variables: method = CompiledBlock [] in SUnit.TestCase>>doTestCycle outerContext = nil copiedValues = an IpsGSGTest.ChangeUserRoleUserStoryTest Arguments: aBlock = BlockClosure [] in SUnit.TestCase>>doTestCycle Temporaries: result = nil Context PC = 4 ---------------------------------------------------------------------- IpsGSGTest.ChangeUserRoleUserStoryTest(SUnit.TestCase)>>doTestCycle Receiver: a IpsGSGTest.ChangeUserRoleUserStoryTest Instance Variables: testSelector = #testChangeRole resources = an IpsGSGTest.UserStoryTestResource Context PC = 11 ---------------------------------------------------------------------- optimized [] in SUnit.TestCase>>run Receiver: an UndefinedObject Temporaries: .self = an IpsGSGTest.ChangeUserRoleUserStoryTest Context PC = 6 ---------------------------------------------------------------------- BlockClosure>>on:do: Receiver: a BlockClosure Instance Variables: method = CompiledBlock [] in SUnit.TestCase>>run outerContext = nil copiedValues = an IpsGSGTest.ChangeUserRoleUserStoryTest Arguments: anExceptionSelector = an ExceptionSet[2] handlerBlock = BlockClosure [] in SUnit.TestCase>>run Context PC = 18 ---------------------------------------------------------------------- IpsGSGTest.ChangeUserRoleUserStoryTest(SUnit.TestCase)>>run Receiver: a IpsGSGTest.ChangeUserRoleUserStoryTest Instance Variables: testSelector = #testChangeRole resources = an IpsGSGTest.UserStoryTestResource Context PC = 14 ---------------------------------------------------------------------- IpsGSGTest.ChangeUserRoleUserStoryTest(SUnit.TestCase)>>debug Receiver: a IpsGSGTest.ChangeUserRoleUserStoryTest Instance Variables: testSelector = #testChangeRole resources = an IpsGSGTest.UserStoryTestResource Context PC = 4 ---------------------------------------------------------------------- optimized [] in Refactory.Browser.SUnitTooMiniBar>>debug: Receiver: an UndefinedObject Temporaries: .aTestCase = an IpsGSGTest.ChangeUserRoleUserStoryTest Context PC = 5 ---------------------------------------------------------------------- BlockClosure>>ensure: Receiver: a BlockClosure Instance Variables: method = CompiledBlock [] in Refactory.Browser.SUnitTooMiniBar>>debug: outerContext = nil copiedValues = an IpsGSGTest.ChangeUserRoleUserStoryTest Arguments: aBlock = BlockClosure [] in Refactory.Browser.SUnitTooMiniBar>>debug: Temporaries: result = nil Context PC = 4 ---------------------------------------------------------------------- Refactory.Browser.SUnitTooMiniBar>>debug: Receiver: a Refactory.Browser.SUnitTooMiniBar Instance Variables: container = a StatusPanel eventHandlers = nil properties = a Dictionary[4] components = an OrderedCollection[3] preferredBounds = nil layoutAlgorithm = BlockClosure [] in Panel>>partFramingBlock: isInUpdate = false codeModel = ChangeUserRoleUserStoryTest>>testChangeRole results = nil testCount = 1 testCountLabel = Label for '1' updateProcess = nil Arguments: aTestCase = an IpsGSGTest.ChangeUserRoleUserStoryTest Context PC = 30 ---------------------------------------------------------------------- optimized [] in Refactory.Browser.SUnitTooMiniBar>>debugTests Receiver: an UndefinedObject Arguments: each = an IpsGSGTest.ChangeUserRoleUserStoryTest Temporaries: .self = a Refactory.Browser.SUnitTooMiniBar Context PC = 7 ---------------------------------------------------------------------- optimized [] in [] in [] in [] in [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: Receiver: an UndefinedObject Temporaries: .self = a Refactory.Browser.SUnitTooProgressOverlay .each = an IpsGSGTest.ChangeUserRoleUserStoryTest .aBlock = BlockClosure [] in Refactory.Browser.SUnitTooMiniBar>>debugTests Context PC = 11 ---------------------------------------------------------------------- UndefinedObject>>ifNil: Receiver: an UndefinedObject Arguments: aBlock = BlockClosure [] in [] in [] in [] in [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: Context PC = 3 ---------------------------------------------------------------------- optimized [] in [] in [] in [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: Receiver: an UndefinedObject Arguments: each = an IpsGSGTest.ChangeUserRoleUserStoryTest Temporaries: .self = a Refactory.Browser.SUnitTooProgressOverlay .aBlock = BlockClosure [] in Refactory.Browser.SUnitTooMiniBar>>debugTests Context PC = 13 ---------------------------------------------------------------------- optimized [] in SUnit.TestSuite>>testCasesFrom:randomDo: Receiver: an UndefinedObject Arguments: each = IpsGSGTest.ChangeUserRoleUserStoryTest>>#testChangeRole Temporaries: .aBlock = BlockClosure [] in [] in [] in [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: Context PC = 7 ---------------------------------------------------------------------- Array(SequenceableCollection)>>do: Receiver: an Array Arguments: aBlock = BlockClosure [] in SUnit.TestSuite>>testCasesFrom:randomDo: Temporaries: i = 1 Context PC = 19 ---------------------------------------------------------------------- SUnit.TestSuite>>testCasesFrom:randomDo: Receiver: a SUnit.TestSuite Instance Variables: resourceAndDefinitions = a Dictionary[1] Arguments: aSetOfDefinitions = a Set[1] aBlock = BlockClosure [] in [] in [] in [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: Temporaries: methods = an Array[1] a = 1 b = 1 random = a LaggedFibonacciRandom Context PC = 63 ---------------------------------------------------------------------- SUnit.TestSuite>>testCasesFrom:do: Receiver: a SUnit.TestSuite Instance Variables: resourceAndDefinitions = a Dictionary[1] Arguments: aSetOfDefinitiions = a Set[1] aBlock = BlockClosure [] in [] in [] in [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: Context PC = 6 ---------------------------------------------------------------------- optimized [] in [] in SUnit.TestSuite>>runUsing: Receiver: an UndefinedObject Arguments: resourceSet = an Array[1] definitions = a Set[1] Temporaries: .self = a SUnit.TestSuite .aBlock = BlockClosure [] in [] in [] in [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: Context PC = 18 ---------------------------------------------------------------------- Dictionary>>keysAndValuesDo: Receiver: a Dictionary Instance Variables: tally = 1 Arguments: aBlock = BlockClosure [] in [] in SUnit.TestSuite>>runUsing: Temporaries: index = 1 elem = #(IpsGSGTest.UserStoryTestResource) -> Set (IpsGSGTest.ChangeUserRoleUserStoryTest>>#testChangeRole) Context PC = 36 ---------------------------------------------------------------------- optimized [] in SUnit.TestSuite>>runUsing: Receiver: an UndefinedObject Temporaries: .self = a SUnit.TestSuite .aBlock = BlockClosure [] in [] in [] in [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: Context PC = 12 ---------------------------------------------------------------------- BlockClosure>>ensure: Receiver: a BlockClosure Instance Variables: method = CompiledBlock [] in SUnit.TestSuite>>runUsing: outerContext = nil copiedValues = an Array[2] Arguments: aBlock = BlockClosure [] in SUnit.Results>>collectWhile: Temporaries: result = nil Context PC = 4 ---------------------------------------------------------------------- SUnit.Results>>collectWhile: Receiver: a SUnit.Results Instance Variables: errors = a Set[1] passes = a Set[0] failures = a Set[0] Arguments: aBlock = BlockClosure [] in SUnit.TestSuite>>runUsing: Context PC = 10 ---------------------------------------------------------------------- SUnit.Results class>>collectWhile: Receiver: a SUnit.Results class Instance Variables: superclass = Object methodDict = a MethodDictionary[26] format = 16387 subclasses = nil instanceVariables = an Array[3] organization = ('accessing' #addError: #addFailure: #addPass: #addResult: #cease #codeToolLabelColor #collect #collectWhile: #defects #errors #errorsCount #failedCount #failures #passCount #passes #ranCount) ('testing' #allPassed #hasErrors #hasFailures #isEmpty) ('bw compat SUnit APIs' #errorCount #failureCount #runCount) ('initialize-release' #initialize) ('printing' #countSelectors #printOn:) name = #Results classPool = a NameSpaceOfClass[0] environment = a NameSpace[36] Arguments: aBlock = BlockClosure [] in SUnit.TestSuite>>runUsing: Context PC = 6 ---------------------------------------------------------------------- SUnit.TestSuite>>runUsing: Receiver: a SUnit.TestSuite Instance Variables: resourceAndDefinitions = a Dictionary[1] Arguments: aBlock = BlockClosure [] in [] in [] in [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: Context PC = 8 ---------------------------------------------------------------------- optimized [] in [] in [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: Receiver: an UndefinedObject Temporaries: .self = a Refactory.Browser.SUnitTooProgressOverlay .aBlock = BlockClosure [] in Refactory.Browser.SUnitTooMiniBar>>debugTests Context PC = 11 ---------------------------------------------------------------------- BlockClosure>>on:do: Receiver: a BlockClosure Instance Variables: method = CompiledBlock [] in [] in [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: outerContext = nil copiedValues = an Array[2] Arguments: anExceptionSelector = SUnit.TestResourceUnavailable handlerBlock = BlockClosure [] in [] in [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: Context PC = 18 ---------------------------------------------------------------------- optimized [] in [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: Receiver: an UndefinedObject Temporaries: .self = a Refactory.Browser.SUnitTooProgressOverlay .aBlock = BlockClosure [] in Refactory.Browser.SUnitTooMiniBar>>debugTests Context PC = 15 ---------------------------------------------------------------------- BlockClosure>>ensure: Receiver: a BlockClosure Instance Variables: method = CompiledBlock [] in [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: outerContext = nil copiedValues = an Array[2] Arguments: aBlock = BlockClosure [] in SUnit.Results>>collectWhile: Temporaries: result = nil Context PC = 4 ---------------------------------------------------------------------- SUnit.Results>>collectWhile: Receiver: a SUnit.Results Instance Variables: errors = a Set[1] passes = a Set[0] failures = a Set[0] Arguments: aBlock = BlockClosure [] in [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: Context PC = 10 ---------------------------------------------------------------------- optimized [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: Receiver: an UndefinedObject Temporaries: .self = a Refactory.Browser.SUnitTooProgressOverlay .aBlock = BlockClosure [] in Refactory.Browser.SUnitTooMiniBar>>debugTests Context PC = 11 ---------------------------------------------------------------------- BlockClosure>>on:do: Receiver: a BlockClosure Instance Variables: method = CompiledBlock [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: outerContext = nil copiedValues = an Array[2] Arguments: anExceptionSelector = TerminateException handlerBlock = BlockClosure [] in [] in Process class>>forBlock:priority: Context PC = 18 ---------------------------------------------------------------------- optimized [] in Process class>>forBlock:priority: Receiver: an UndefinedObject Temporaries: .aBlock = BlockClosure [] in Refactory.Browser.SUnitTooProgressOverlay>>runSuiteUsing: Context PC = 9 _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
I encountered your problem a number of times. I
also found that this behaviour is not allways consistent from database to
database and especially between ODBC and the others. It would therefore
be interesting to know what Database you are using (did'nt recognise it
from the stack) and if you can reproduce it on other platforms. A few of these
problems have been driving me nuts as what worked on one of them didn't
work on the other and vice versa.
Most of the time however I get over it by doing
things in a slightly different way. In your case I would typically try something
like given below.
@+Maarten,
resources loginDuring: [ :session | | peter users
|
self assert: peter notNil.
self assert: peter role notNil. self assert: peter role name = 'trader' . aRole:=session readOneOf: RoleBehavior where: [ :role | role name = 'trader' ]. session inUnitOfWorkDo: [ peter :=
session
readOneOf: User where: [ :user | user userID = 'peter' ]. peter isNil ifFalse:[ peter role: (aRole) ]]. self assert: peter role name = 'trader'. session inUnitOfWorkDo: [
session register: peter. peter name: 'peter other' ]. self assert: peter role name = 'trader'.
users := session readManyOf: User.
self assert: users notNil. self assert: users notEmpty ] a number of times this
_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
As discussed in the glorp list, that really shouldn't
happen. And it should be completely independent of database. Well, really, there are two possible errors of this sort - The first is that the database is complaining that you tried to insert two objects with the same key. That could happen for a variety of reasons, including the application code doing something odd and two people trying to insert with a non-generated key at the same time. But that's not what's happening here. In that case we'd be getting a database error message. - The second is that, within a session, you're getting two different objects registered as being under the same primary key. That can happen if you do things like mix objects that were read between two sessions, or use session reset but hold onto objects it had already read and re-register them later. But with a single session, that really should never happen, so I'm very curious what Andres is seeing. At 11:44 PM 2010-03-18, Maarten MOSTERT wrote: I encountered your problem a number of times. I also found that this behaviour is not allways consistent from database to database and especially between ODBC and the others. It would therefore be interesting to know what Database you are using (did'nt recognise it from the stack) and if you can reproduce it on other platforms. A few of these problems have been driving me nuts as what worked on one of them didn't work on the other and vice versa. |