Persistence Layer: Save form definitions with attachments at once

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Persistence Layer: Save form definitions with attachments at once

bruno.buzzi
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Persistence Layer: Save form definitions with attachments at once

Alessandro  Vernet
Administrator
Hi Bruno,

We're saving the attachment first because the persistence API lacks any concept of transaction, which means that:

1. If you save the attachment first, the form data next, if that last step fails you might end up with an attachment that isn't referenced from anywhere. This just uses unnecessary space in your database, which could be freed easily, so isn't a huge problem.

2. If you save the data first, and attachments next, you might end up with data that is missing its attachments in the database.

Having some kind of support for transactions, or sending the data and the attachments in one query would be better, but it would also make things more complicated, so, for the time being, we went with option 1 as it creates less problems than option 2. Does that make sense?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Persistence Layer: Save form definitions with attachments at once

bruno.buzzi
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Persistence Layer: Save form definitions with attachments at once

bruno.buzzi
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Persistence Layer: Save form definitions with attachments at once

Alessandro  Vernet
Administrator
Hi Bruno, excellent, I am glad you found a solution for this one.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet