|
Re: [EMF][Teneo][Transaction] what's the best way to combine them... [message #834582 is a reply to message #834489] |
Mon, 02 April 2012 05:52 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Simon,
I am sorry, I have no experience with EMF transaction, so I can't give a sensible reply. Teneo and EMF Transaction are
not used together afaik, most of the time people rely on Teneo to do the transaction and validation. If a save fails the
error is displayed and the user can edit the invalid data to bring it to a valid state.
But your nested transaction seems worth a try, have you tried it?
gr. Martin
On 04/02/2012 04:21 AM, Simon Chen wrote:
> I am Hoping to use EMF transaction to ensure data integrity, and help rollback in case certain operations violate my
> data model.
> At the same time, I want to use Teneo to persist the my model data to a backend db.
>
> Actually, when I save data via Teneo, it does some validation too. Should I simply rely on that?
>
> Or should I have some kind of nested transaction?
>
> Outer-trans:
> Change model data;
> Validate or roll back;
> Inner trans:
> Save to Teneo;
> Roll back outer in case of inner (db) failure.
>
>
> I am probably deeply confused about these concepts... What's the best solution here? How can I make sure my db and my
> model are in-sync, as well as model integrity?
>
> Thanks.
> -Simon
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
|
|
|
|
Re: [EMF][Teneo][Transaction] what's the best way to combine them... [message #834902 is a reply to message #834858] |
Mon, 02 April 2012 14:34 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Simon,
The hibernate session has a refresh method which reloads from the db. But as you say it is quite expensive to do that
for many objects.
gr. Martin
On 04/02/2012 03:40 PM, Simon Chen wrote:
> Thanks, Martin...
>
> No, I haven't tried the nested transaction, but I plan to.
>
> My feeling is that manual rollback isn't convenient enough, especially if a transaction touches many objects.
>
> I was hoping there is a way to use Teneo to directly "reload" from the DB, thus discard the changes made to the model.
> This is more expensive than rollback locally using EMF transaction, but seems easier to do with Teneo... Not sure which
> method to use though, still experimenting...
>
> -Simon
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
|
|
|
Powered by
FUDForum. Page generated in 0.02846 seconds