Re: Record caching
"t.leichner" <[email protected]> Sun, 07 Jun 2009 18:24:49 -0000
| Newsgroups | gmane.comp.java.orm.simpleorm |
|---|---|
| Message-ID | <[email protected]> |
--- In [email protected], gary adams <gershonadams@...> wrote: > > > I have been using SimpleORM for the last two months and its a great tool. I have a question about record caching > > > > If one has static information in the database that he wants to cache in an application, like configuration information, what is the proper methodology of doing this with simpleORM? The app will need access to this information throughout its life. > > > > I have done it likes this. > > > LIST<x> listX= session.queryNoFlush(queryDEF); > session.commitAndDetachDataSet(); > > Is this correct? I am concerned that the commit being done in the class that requires the cache will affect other items in the database that should not be committed yet. > You can make this action as first one after starting your program. So no other items in the database can be affected, because your program hasn't any open transactions yet. > Along the same lines, what is the proper way to attaching records to a dataset from a rawquery? I have used > session.getDataSet().attach(record), but I am concerned because it is deprecated. You can use something like: SRecordMeta<? extends SRecordInstance> metaRec; SRecordInstance record = dataSet.createWithNullKey( metaRec ); Then you fill the record with functions like: record.setString( f, value ); Good luck Thomas ------------------------------------ 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: mailto:[email protected] mailto:[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/