grouped collection with accessname

1 view
Skip to first unread message

Simon Oberhammer

unread,
May 28, 2009, 9:04:58 AM5/28/09
to Helma
hi group,
in short: i have a problem with grouped collections that looks similar
to #445, but #445's workaround doesn't work :| Only invalidating the
whole collection helps. tried helma-trunk and helma.1.6.3

I get NPE "error retrieving node" when *adding* an object to a grouped
collection, right after removing a similar object (belonging to same
group) from this collection, which was added in the same request.
before the NPE-provoking add i do removeChild(addedObject) on
everything that makes remotly sense and the collection isn't even
aggressivly cached.

I modified the demo-generic-references app to show the problem - see
attachment. The crucial collection is Image.tagsByName which is a
grouped collection, with accessname being the Tags target_id (the
image itself). Root.main_action is where it all happens.

this problem goes away if one of the following is true:
* no accessname on grouped collection (this led me to #445)
* the grouped collection already contains a persisted object before
Root.main_action is called (you can get to that state by uncommenting
the workaround in line 23)
* call res.commit() after remove() (see line 22)

uh.. took me a while to boil it down to this smallish testcase. and i
realize it's still a mouthfull :|
simon

ps.: if this all seems very contrieved and you want a justification
for doing smth like that: in my real app I have a Relation object with
pointers to a source and destination object. those source &
destination objects have collections pointing back to the Relations,
and those back-pointing collection have accessname src_/dst_id. so Tag
is mocking up a Relation.

Simon Oberhammer

unread,
May 28, 2009, 9:06:48 AM5/28/09
to Helma
the demo app i talked about...
groupcollection-npe.tgz
Reply all
Reply to author
Forward
0 new messages