On Thu, Jan 22, 2009 at 05:05:42PM +0100, Moritz Rebbert wrote:
> Hello Alex,
>
> On Thu, Jan 22, 2009 at 01:58:14PM +0100, Alexander Klimetschek wrote:
> > On Thu, Jan 22, 2009 at 2:16 AM, Moritz Rebbert <[email protected]>
> > wrote:
> > > }finally{
> > > session.logout();
> > > }
> >
> > Not sure, but I think the session.logout() could be a harm, because it
> > will eventually happen before the transaction commit. Try to comment
> > it out and see what happens.
>
> But where else should i put the session.logout()?
> Is it implictly called by the commit of the underlying XAResource?
> I think i have done this before, but ran into the problem that the
> session pool ran out of session or sth. like that.
> But i will try it and give a feedback soon.
I have tried it without any session.logout();
But the same Exception occures.
>
> In my opinion this leads considerations:
> If the session.logout() should be placed after the sessions commits,
> shouldn't the login be call also before the transaction starts?
>
> Like that:
>
> session = repository.login();
> createFolder("foo",session);
> session.logout();
>
>
> and
>
> @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
> void createFolder(String str, Session session){
> session.getRootNode(str,"nt:folder");
> session.save();
> }
>
> I have done this, but than the session won't be internaly enlisted to
> the Transaction. The enlistment is only called within the
> repository.login().
> And so it is not allowed to use a session in more than one Transaction,
> isn't it?
>
> Regards
> Moritz
>