Return-Path: X-Original-To: apmail-jackrabbit-dev-archive@www.apache.org Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B86BB10E40 for ; Fri, 6 Sep 2013 09:03:16 +0000 (UTC) Received: (qmail 74302 invoked by uid 500); 6 Sep 2013 09:03:16 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 73921 invoked by uid 500); 6 Sep 2013 09:03:08 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 73913 invoked by uid 99); 6 Sep 2013 09:03:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Sep 2013 09:03:06 +0000 X-ASF-Spam-Status: No, hits=3.5 required=5.0 tests=HTML_MESSAGE,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [195.137.237.88] (HELO vps.dezide.dk) (195.137.237.88) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Sep 2013 09:03:01 +0000 Received: from [10.0.0.92] (unknown [87.116.17.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by vps.dezide.dk (Postfix) with ESMTP id B3124184017 for ; Fri, 6 Sep 2013 10:47:40 +0200 (CEST) Message-ID: <52299A2D.4010101@dezide.com> Date: Fri, 06 Sep 2013 11:02:37 +0200 From: Chris Poulsen User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: dev@jackrabbit.apache.org Subject: Re: SV: Jackrabbit JCA and JTA References: <000501ceaa60$6aa120d0$3fe36270$@breakpoint.no> In-Reply-To: <000501ceaa60$6aa120d0$3fe36270$@breakpoint.no> Content-Type: multipart/alternative; boundary="------------030009010601060005090208" X-Virus-Checked: Checked by ClamAV on apache.org This is a multi-part message in MIME format. --------------030009010601060005090208 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Apparently my mail client decided to screw me over ;-) here is the complete msg. Hi, I've used a corner of the se-jcr (spring-extensions jcr) library v0.9 to get this going in our application (a horribly old/not maintained library). Our transactions are driven by the use of @Transactional to allow us to have tests running with transactions. I ended up not using the OSV pattern for JCR, it gave me more trouble than benefits. Instead I ended up using: SessionFactoryUtils.getSession() and SessionFactoryUtils.releaseSession() from the spring module, this ensures that the JCR session is registered with the spring transaction synchronization stuff and did not impact my pre-transactional code much. HTH. -- Chris On 05-09-2013 19:51, andreas wrote: > > Hello > > It seems like the Jackrabbit session commits independently of the > other code. I have no idea why. > > *Fra:*Chris Poulsen [via Jackrabbit] [mailto:[hidden email] > ] > *Sendt:* 5. september 2013 09:49 > *Til:* andreas > *Emne:* Re: Jackrabbit JCA and JTA > > Hi, > > I don't know about file storing vs. transactions, but I would expect it > to work like any other transactional change to the repository. > > Getting the JTA setup correctly can be somewhat of a tricky task - Are > you sure that you are in a transaction in your method (and that you are > in the correct transaction)? > > Have you tried adding a simple node in the transaction method to see if > a simple node is rolled back? Also you can usually ask spring and the > JTA provider to produce really detailed logs to help you figure out what > is going on. > > HTH. > -- > Chris > > On 04-09-2013 18:09, andreas wrote: > > > > Hi > > > > I am developing an application that uses both Jackrabbit and a > database. In > > Jackrabbit I store the files that I upload, and the database I store > all the > > other data in the app. I am using Spring 3.2, Hibernate 4.x and > Jackrabbit > > 2.6.2. I have downloaded the Jackrabbit JCA version and deployed it > to JBoss > > 7.1.1. I have configured it correctly I think. I can upload file to > it and > > it is saved. I also debugged my application and I saw that the session > > object that invoke save() and logout() on is of type XaSession. I am > using > > the datastore. > > > > The way I tested my code is like this: I have one method in the service > > layer of my app annotated with @Transactional. Inside the method I > first add > > a file to the content repository, then I force a RunTimeException to be > > thrown (and the code that should run instead of the exception would > be to > > save my object to the database through Hibernate). I cleared the > datastore > > (no files inside it) but when the exception is thrown the file that > I added > > isn't removed from the datastore. > > > > So, is this correct? Does files in datastore stay in the datastore - > not > > rolled back? Or should it be removed. I am using the > > annotation in Spring config. > > > > Could someone shed some light over this because I don't understand > if I got > > it working, or if I need to do something else to get it working? And > where > > does the metadata of the file that I add get stored? I have > configured a own > > database for the persistence manager but I don't see anything useful > in the > > database tables? There are only a lot of what seems to be binary things > > there? Is there a way to verify if a file is inserted or not in the > database > > even though the actual file is stored on disk (datastore)? > > > > Thank you > > > > - Andreas > > > > > > > > -- > > View this message in context: click here. > NAML > > > > ------------------------------------------------------------------------ > View this message in context: SV: Jackrabbit JCA and JTA > > Sent from the Jackrabbit - Dev mailing list archive > > at Nabble.com. --------------030009010601060005090208 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
Apparently my mail client decided to screw me over ;-) here is the complete msg.

Hi,

I've used a corner of the se-jcr (spring-extensions jcr) library v0.9 to get this going in our application (a horribly old/not maintained library).

Our transactions are driven by the use of @Transactional to allow us to have tests running with transactions.

I ended up not using the OSV pattern for JCR, it gave me more trouble than benefits. Instead I ended up using:

SessionFactoryUtils.getSession() and SessionFactoryUtils.releaseSession() from the spring module, this ensures that the JCR session is registered with the spring transaction synchronization stuff and did not impact my pre-transactional code much.

HTH.
--
Chris

On 05-09-2013 19:51, andreas wrote:

Hello

It seems like the Jackrabbit session commits independently of the other code. I have no idea why.

 

Fra: Chris Poulsen [via Jackrabbit] [mailto:[hidden email]]
Sendt: 5. september 2013 09:49
Til: andreas
Emne: Re: Jackrabbit JCA and JTA

 

Hi,

I don't know about file storing vs. transactions, but I would expect it
to work like any other transactional change to the repository.

Getting the JTA setup correctly can be somewhat of a tricky task - Are
you sure that you are in a transaction in your method (and that you are
in the correct transaction)?

Have you tried adding a simple node in the transaction method to see if
a simple node is rolled back? Also you can usually ask spring and the
JTA provider to produce really detailed logs to help you figure out what
is going on.

HTH.
--
Chris

On 04-09-2013 18:09, andreas wrote:


> Hi
>
> I am developing an application that uses both Jackrabbit and a database. In
> Jackrabbit I store the files that I upload, and the database I store all the
> other data in the app. I am using Spring 3.2, Hibernate 4.x and Jackrabbit
> 2.6.2. I have downloaded the Jackrabbit JCA version and deployed it to JBoss
> 7.1.1. I have configured it correctly I think. I can upload file to it and
> it is saved. I also debugged my application and I saw that the session
> object that invoke save() and logout() on is of type XaSession. I am using
> the datastore.
>
> The way I tested my code is like this: I have one method in the service
> layer of my app annotated with @Transactional. Inside the method I first add
> a file to the content repository, then I force a RunTimeException to be
> thrown (and the code that should run instead of the exception would be to
> save my object to the database through Hibernate). I cleared the datastore
> (no files inside it) but when the exception is thrown the file that I added
> isn't removed from the datastore.
>
> So, is this correct? Does files in datastore stay in the datastore - not
> rolled back? Or should it be removed. I am using the
> <tx:jta-transaction-manager /> annotation in Spring config.
>
> Could someone shed some light over this because I don't understand if I got
> it working, or if I need to do something else to get it working? And where
> does the metadata of the file that I add get stored? I have configured a own
> database for the persistence manager but I don't see anything useful in the
> database tables? There are only a lot of what seems to be binary things
> there? Is there a way to verify if a file is inserted or not in the database
> even though the actual file is stored on disk (datastore)?
>
> Thank you
>
> - Andreas
>
>
>
> --
> View this message in context: click here.
NAML


View this message in context: SV: Jackrabbit JCA and JTA
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.

--------------030009010601060005090208--