OK, I don't have solved everything but I have found the origin of the stackoverflow... I coded a Recursive VelocityMacro and apparently variables inside VM macro are not local and it makes my recursion infinite!!! Apparently, there is an option in velocity to make local macro variables have only a local scope. Do you see any problem about this? I have modified my dbstringlist SQL query to use only one column to be sure this is the easiest case... I then add a listitem manually to the list property of the object in my velocity script. Everything is OK but sometimes the list item appears in the object editor, sometimes not and i don't understand why yet! Still investigating! best regards PAscal On Thu, Oct 2, 2008 at 6:22 PM, Pascal Voitot <[email protected]>wrote:
plz see below
thks Pascal
On Thu, Oct 2, 2008 at 6:01 PM, Sergiu Dumitriu <[email protected]> wrote:
Pascal Voitot wrote:
hello guys, I do the following: - I have a class with a DBStringList property "mylist" - In a velocity script, I do: #set($obj = $doc.getObject("MyClass", $mynb)
#set($mylist = $obj.get("mylist")) #set($mylist = "${mylist}|${mynewlistitem}") #set($ret = $obj.set("mylist", $mylist))
#set($ret = $doc.save())
- I run this script and I can see in the DB that "mynewlistitem" was added as listitem to "mylist" but the item doesn't appear in the object editor for property "mylist" in my document. - Moreover, I get some rendering exception in contentview.vm when I try to access this object in other velocity scripts. - When I create the link using the Object editor, then everything works well but I don't see anything different in the DB from the previous state.
- I have tried the same with: #set($obj = $doc.getObject("MyClass", $mynb)
#set($mylist = $obj.getProperty("mylist").getValue()) #set($ret = $mylist.add("${mynewlistitem}"))
#set($ret = $doc.save())
same result...
It seems the Object property is saved but it is not taken into account by the object in the document.
Do you any clue for me?
- is the property multiselect? relational storage?
multiselect relation storage
- would the mynewlistitem value be returned by the DB search? Or is it a new value you want to include manually?
in Object editor, I use the DB search to return this value (which is stored in DB) plus another string (which is the displayed value)
select myvalue, mystring from ...
In my velocity script, I had this value manually directly accessing the property... But after that, I verify it has been stored using the Object editor...
- does the DB query normally return one or two values?
2 values
- what exactly is the error you receive?
I don't have it here now but this is a kind of StackOverflow in getRenderedContent()
I will search with the debugger if you don't have any quick idea... In fact, as my property is well stored in the DB (I have verified manually), I don't see the wrong interaction between this property and its object in this case... what's different between accessing the property from the object editor or from my velocity script?
-- Sergiu Dumitriu http://purl.org/net/sergiu/ _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs