On 29/09/2014 12:08, Guido Wimmel wrote:
Hi,
we observed that when UserController.resolveReferences() is called before the
creation of a User via UserController.create(),
Syncope tries to read the user with id==0 (via binder.getUserTO()). This always
fails (which is ignored), but may cause an unnecessary query to the database
and the creation of a transaction that must be rolled back because of a
NotFoundException thrown by UserDataBinder.
This also would make it difficult to make functionality in UserController which
creates users transactional.
Would it be a useful optimization to check for id!=0 in
UserController.resolveReferences()? (and similar in other controllers?)
Sure: I don't see any problems with this and I also believe that current
integration tests are strong enough to raise problems, in case.
Is there a specific reason why create() is not marked transactional currently,
but some other methods in UserController are?
It is, indeed: the create() (and others) method are *not* marked as
transactional because the invocations made inside create()'s body
constitute separate transactions: create into the internal storage via
workflow, propagation, notification, and so on.
Regards.
--
Francesco Chicchiriccò
Tirasa - Open Source Excellence
http://www.tirasa.net/
Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC
http://people.apache.org/~ilgrosso/