Re: Thoughts from ADO
Franck Routier <[email protected]> Fri, 26 Nov 2010 10:00:51 +0100
| Newsgroups | gmane.comp.java.orm.simpleorm |
|---|---|
| Organization | Axège sarl |
| Message-ID | <1290762051.21508.18.camel@franck-laptop> |
Hi,
Le vendredi 26 novembre 2010 à 10:33 +0200, Noel Grandin a écrit :
> I think there are some things you are just going to have to handle at
> a higher level, and this is one of them.
Yes, I agree we want to keep Simpleorm simple... but...
That's what I do right now; that is in my DAO layer, I have a method
checkCustomConstraints that get called before a dataset is persisted.
My problem is that a dataset can have every kind of records. So I must
make sure custom constraints are called for each record type in the
dataset... (before Sorm3, I was handling lists of records of the same
type, so it was must easier).
> I've seen frameworks where this is possible, but the downside is that
> performance becomes very non-obvious, because the framework has to
> query the database in order to perform cross-record validation.
> On the other hand, you could always override doValidateRecord() and do
> your extra validation there?
>
Well, doing it in doValidateRecord can be tricky, as it is called while
the session has begun (on flush). So you'll have to get the the current
thread's session and use queryNoFlush to get extra records from
database, then check against still unflushed records in the dataset...
Well, I could experiment with it...
...
Franck
------------------------------------
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/