ICreateBatch and Java proxy objects

4
Is it possible to use proxies with the ICreateBatch class? For example: ICreateBatch batch = Core.createBatch (getContext(), MyProxy.getType(), 200, false, false); batch.create(); MyProxy proxy = MyProxy.initialize(batch.getCurrentObject()); proxy.setAttribute(“A new value”); If this is feasible are there any implications to this approach? For example, if another call to create() is made between initialising the proxy and setting a parameter will the reference still be valid and the change propagated to the database?
asked
1 answers
4

You can use the create batch in combination with proxies.

Some remarks:

  • The reference retrieved from getCurrentObject stays valid after a create call (the internal currentObject field will point to the new object, previous objects are stored in a list).
  • If the commit method is called all objects will be stored in the database and the references will become invalid. Note that the commit method also will be called when autocommit is true and the batchsize has been reached.
  • A CreateBatch is not thread-safe.
answered