Best way to perform a bulk insert

Related to this question: http://support.backendless.com/t/saving-multiple-data-objects-with-one-request, and this other: http://support.backendless.com/t/server-code-error-in-backendless-sdk-when-saving-new-entity#comment-14687

I would like to know several things:

    To insert multiple objects at once, does this need to be done with API Engine or could it be done using an EventHandler? I would like the user calling this API or Custom Event, to be the owner of the inserted object.
In the second mentioned question I can see that the provided RunnerContext has a userId and a userToken, but not the userPassword.

How can I perform the Java SDK login call with that information??
Thanks and sorry about reopening old topics, but I thought that I could be extending information for the same problem.

To insert multiple objects at once, does this need to be done with API Engine or could it be done using an EventHandler?

API Engine lets you create service APIs from the deployed code. When the generated APIs are invoked by your code, the corresponding methods in the services is executed.

EvenHandlers are invoked in response to Backendless APIs. That is when your app uses any of our APIs and if there is an event handler “attached” to an API, that’s when it is invoked.

With that said, you can add your logic to insert objects in both places, but which one is better for your app would be up to you…

I would like the user calling this API or Custom Event, to be the owner of the inserted object.

In order to accomplish this, your server code (in API Engine or custom event) would need to re-use the userToken which is provided to your code. The userToken identifies the user session and the user himself. The userToken value is available in the RunnerContext object (applies to custom events) and InvocationContext class (applies to API Engine services). Once you have userToken, it must be added as shown below:

HeadersManager.getInstance().addHeader( HeadersManager.HeadersEnum.USER_TOKEN_KEY, userToken )