Velocity in groovy

Hello

I want to create pages automatically from a database.

With groovy, I can query the database to retrieve the titles and contents of the pages
dbSql.eachRow(dbQuery) { println "$it.Title"; println "$it.Content"; }

With velocity, I know how to create a page:

#set ($mydoc = $xwiki.getDocument("MySpace.MyPage"))
#set ($discard = $mydoc.setContent("test"))
#set ($discard = $mydoc.save())   

I read that nested velocity is forbidden :

{{groovy}}
      {{velocity}}
      {{/velocity}}
{{/groovy}}

Have you a solution to create page in
dbSql.eachRow(dbQuery) { "Create_Page..." } ?
Best Regards
Alain

You can do everything in groovy.

For example the script you wrote in velocity can be written in groovy, see https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/Scripting/

def mydoc = xwiki.getDocument("MySpace.MyPage"))
mydoc.setContent("test")
mydoc.save()

Thank you for your reply.
It’s easier as it
Alain