Is there any specific reason you want to disable the user mid-action? Presumably user actions are short lived, so if user A has the necessary permissions at the start of the request, it should stay that way until the next user request?
Mike On 5/31/07, René Günther <[EMAIL PROTECTED]> wrote:
If I call document.getUser().setVersion(null) Hibernate throws org.hibernate.StaleObjectStateException if the other guy disables User A. This could be a solution. But maybe this is the wrong approach? -----Ursprüngliche Nachricht----- Von: René Günther [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 31. Mai 2007 17:57 An: [email protected] Betreff: [appfuse-user] DB Transactions in Service Layer? Hello, assume I got a webapp where documents are assigned to users. The user must be an enabled user. I want to assign a document to user A who is enabled when the service layer is processed: if (document.getUser.getEnabled()) dao.save(document); But it the very short time between the check in the service layer and the real table update in the database layer, some other guy disables user A. The update of the document should fail! So do I have to implement the check in database layer? What do you suggest? Can I lock the User instance in short time between document.getUser().getEnabled() and SQL statement to update the document? Thanks René --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
