I recommend using modulo to do the split.
Create a few variables in your pipeline:
maxPerBatch = 5000
currentCount = 0
When in your loop increment currentCount by one.
Do a branch that checks for currentCount % maxPerBatch == 0
(that is, currentCount modulo maxPerBatch equals 0)
If true branch out and do your batch insert.
Oh, also you need to handle the situation where the last batch is less than 5000 but still needs to be inserted. Another branch or a branch after your loop should do the trick which activates only if the last batch size is > 0.
Make sense?
P.S. Modulo is easy in java: n % m is about all it takes.
#webMethods#Flow-and-Java-services#Integration-Server-and-ESB