Hi Kristian,
your Statement consists of a horribly large in-list and a wast amount
of OR ((A_.id>=3129268) AND (A_.id<=3129287)) clauses.
Beside that this generated statement is just badly designed (how
about temporary tables? or the BETWEEN clause?) all this gives the
optimizer MUCH to think about.
So I guess the Stack-Overflow is what it says it is: a Stack-Overflow.
Check the _MAXTASK_STACK size Parameter of your Database. Increase
it, if it's not possible to change the statement.
The _PACKET_SIZE Parameter has nothing to do with this error, since
the statement is not too long - it's too complicated.
Perhaps this helps.
KR Lars
BTW: it's always a good idea to also post the version/build
information and platform of your db...