jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Guggisberg" <stefan.guggisb...@gmail.com>
Subject Re: session.importXML transactional
Date Thu, 26 Oct 2006 09:49:43 GMT
On 10/26/06, quipere <jquipere@hotmail.com> wrote:
>
> Thx, I discovered that the Workspace.importXML is indeed an 'all or nothing'
> implementation. That is exactly what I need. But I also need the trancient
> state of the XML because I save some other items on the same session that
> have a relation with the imported XML.
>
> Does Jackrabbit support to persisting items within a transaction?

jackrabbit supports JTA transactions,
see e.g. http://jackrabbit.apache.org/faq.html#using-jta

cheers
stefan

>
>
> Stefan Guggisberg wrote:
> >
> > On 10/26/06, quipere <jquipere@hotmail.com> wrote:
> >>
> >> Hi,
> >>
> >> Is session.importXML supposed to be transactional?
> >
> > it depends on what you mean by transactional.
> > nodes and properties imported by Session.importXML()
> > are 'transient', i.e. in order to be persistent they need
> > to be saved. the result of Item.save()/Session.save()
> > is 'all or nothing', either everything is successfully
> > persisted or nothing is persisted at all.
> >
> > an implementation is free to throw an exception at any
> > point during the import. the sepcification is unclear
> > whether the result of calling Session.importXML()
> > should be 'all or nothing'.
> >
> >>
> >> When I do something like this
> >>
> >> try {
> >>     session.importXML("somePath", someStream,
> >> ImportUUIDBehaviour.IMPORT_UUID_COLLISION_REPLACE_EXISTING)
> >> } catch(ValueFormatException vfe) {
> >>     //collect exception but proceed with nextfile
> >> }
> >>
> >> session.save();
> >>
> >> When a valueformat is thrown, half of the xml untill the source of the
> >> valueformat,  is stored in JCR because of the session.save(). Shouldn't
> >> it
> >> be transactional so no nodes are persisted when a exception is thrown?
> >
> > you could use Workspace.importXML() if you need a 'all or nothing' import.
> >
> > cheers
> > stefan
> >
> >> --
> >> View this message in context:
> >> http://www.nabble.com/session.importXML-transactional-tf2512772.html#a7007568
> >> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/session.importXML-transactional-tf2512772.html#a7007951
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>
>

Mime
View raw message