Hi Rafael,

Sessions in JCR are not thread-safe, so each user/request should have
its own session (Sessions are designed to be retrieved and released
quickly, unlike a jdbc connection). If all your threads use the same
session, this might be the reason for the (somewhat unexpected)
ConstraintViolationException.

To avoid conflicts, you can solve that by using a good content model
or for example using open-scoped locking. You might also design your
application to handle conflicts, ie. keep the content that could not
be saved and offer a conflict resolution to the user (eg. "was already
modified, here is the difference / do you want to overwrite / etc.").

Regards,
Alex

On Thu, Nov 13, 2008 at 1:28 PM, RafalJanik <[EMAIL PROTECTED]> wrote:
> Hi
> I'm testing JackRabbit and i'm wondering how it will be work when many users
> in the same time start adding the nodes and uploading the files. So I make
> few threads - each one gets reference to Session.
> When task is done there is a line (Session) session.save() but if in another
> thread e.g. uploading is in progress  there  is  an Exception
> (javax.jcr.nodetype.ConstraintViolationException:) - i think it is caused by
> saving action in first thread which wants to save session in the thread with
> uploading and not all mandatory fields have been written yet... Is it
> correct?
> And how can I run adding or uploading nodes on two or more threads?  Is
> method join() only a reason?
> What i should do to make my application with JackRabbit enable for many
> users to edit in the same time ?
>
> Cheers
>
> Rafael
>



-- 
Alexander Klimetschek
[EMAIL PROTECTED]

Reply via email to