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:20:32 GMT
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,
> } 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.


> --
> 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 raw message