On 10/26/06, quipere <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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.


Reply via email to