Re: RE:Using SimpleORM in a web app

Franck Routier <[email protected]> Mon, 20 Dec 2010 11:28:50 +0100
Newsgroups gmane.comp.java.orm.simpleorm
Organization Axège sarl
Message-ID <1292840930.8760.11.camel@franck-laptop>
Hi,

if you flush something in the session and an error occurs, the session
will be rooled back and the dataset destroyed, to prevent incoherent
dataset (*).

So in the case you know you can encounter an exception and want to be
able to recover, you should :

1) clone your dataset

SDataSet rescueDs = ds.clone();

2) run you session

3) in the catch block, in case of an exception, find a way to return the
rescue dataset.

I will publish today a project I made to use Simpleorm in
Springframework way. In this project, I created a
DataValidationException that can hold a (rescue) dataset for the
business layer to recover from. Stay tuned, I'll make a post in a few
hours.

Regards,
Franck


(*) the underlying problem would be to be able to "rollback" the state
of the dataset, which is complicated. You will find attempts to do that
in the code (look for savepoint in commented out code), but finally
Anthony came with a simplier solution : cloning datasets).




------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/SimpleORM/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/SimpleORM/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/