RE: Re: New SimpleORM Whitepaper

Anthony Berglas <[email protected]>
Newsgroups gmane.comp.java.orm.simpleorm
Message-ID <[email protected]>
Hello Harry,

Good point, I fixed isEmpty, but to the code 
below (avoids creating the trimmed object).

You mentioned "Oracle Locking",  what are you doing with it?

Anthony

     public boolean isEmpty(SFieldMeta field) {
         Object obj = getObject(field);
         if (obj == null) return true;
         if (obj instanceof String) {
             String str = (String)obj;
             for (int sx=0; sx < str.length(); sx++)
                 if (str.charAt(sx) != ' ') return false;
             return true;
         }
         return false;
         }

At 12:54 AM 3/09/2008, Harry wrote:
>Hi Anthony,
>
>I have downloaded version 3.0 and also revision 806 on svn.
>
>For the moment I have just recompiled and it does not recompile
>against 1.5. Here are 2 modifications I made to make it compile
>against 1.5 :
>
>-------------------------------------------------------------------------------
>Method :
>
>simpleorm.dataset.SRecordInstance.isEmpty(SFieldMeta)
>
>Replaced
>
>public boolean isEmpty(SFieldMeta field) {
>         Object obj = getObject(field);
>         if (obj == null) return true;
>         if (obj instanceof String) {
>             String str = (String)obj;
>             if (str.isEmpty()) return true;
>             if (str.trim().isEmpty()) return true; // little expensive
>         }
>         return false;
>}
>
>With
>
>public boolean isEmpty(SFieldMeta field) {
>         Object obj = getObject(field);
>         if (obj == null) return true;
>         if (obj instanceof String) {
>             String str = (String)obj;
>             if (str.trim().equals("")) return true;
>         }
>         return false;
>}
>
>Rationale :
>
>String.isEmpty() only exists since java 6, and comparing with "" does the job
>also.
>Most of the time the object is not empty, so comparing with "" and then
>trimming and comparing again with "" is actually more expensive than
>systematically trimming and comparing with "".
>
>
>-------------------------------------------------------------------------------
>Method:
>simpleorm.sessionjdbc.SQueryExecute.addJoinedSelectFields(SFieldScalar[],
>Map<SRecordMeta<?>, SSelectMode>, SRecordMeta<?>)
>
>Replaced
>
>         private SFieldScalar[] addJoinedSelectFields(
>         SFieldScalar[] selectList, 
> Map<SRecordMeta<?>, SSelectMode> joinTables,
>SRecordMeta<?> mainMeta) {
>
>                 SFieldScalar[] result = selectList == null ?
>mainMeta.getQueriedScalarFields() : selectList;
>                 for (Map.Entry<SRecordMeta<?>, SSelectMode> entry :
>joinTables.entrySet()) {
>                         int resSize = result.length;
>                         if ( ! SSelectMode.SNONE.equals(entry.getValue())) {
>                                 SFieldScalar[] joinFlds =
>entry.getKey().fieldsForMode(entry.getValue());
>                                 result = Arrays.copyOf(result,
>result.length+joinFlds.length);
>                                 for (int i = 0; i < joinFlds.length; i++) {
>                                         result[i+resSize] = joinFlds[i];
>                                 }
>                         }
>                 }
>                 return result;
>         }
>
>With
>
>         private SFieldScalar[] addJoinedSelectFields(
>         SFieldScalar[] selectList, 
> Map<SRecordMeta<?>, SSelectMode> joinTables,
>SRecordMeta<?> mainMeta) {
>
>                 SFieldScalar[] result = selectList == null ?
>mainMeta.getQueriedScalarFields() : selectList;
>                 ArrayList<SFieldScalar> resultLst = new
>ArrayList<SFieldScalar>(Arrays.asList(result));
>                 for (Map.Entry<SRecordMeta<?>, SSelectMode> entry :
>joinTables.entrySet()) {
>                         int resSize = result.length;
>                         if ( ! SSelectMode.SNONE.equals(entry.getValue())) {
>                                 SFieldScalar[] joinFlds =
>entry.getKey().fieldsForMode(entry.getValue());
>                                 resultLst.addAll(Arrays.asList(joinFlds));
>                         }
>                 }
>                 result = resultLst.toArray(new 
> SFieldScalar[resultLst.size()]);
>                 return result;
>         }
>
>Rationale :
>
>Arrays.copyOf exists starting with jdk 6 only.
>Using java collections and adding to a list is just as efficient, the list
>is converted back to an array at the end.
>
>-------------------------------------------------------------------------------
>
>I am testing further aspects against my app.
>
>Best regards,
>
>Harry
>
>                                                        Harry Karadimas
>______________________________________________________________________
>Dr Harry Karadimas  Medecin Ingenieur
>resp. Recherche et Developpement, Administration Wintel
>Departement d'Information Hospitalier (DIH)
>C.H.U. Albert Chenevier - Henri Mondor
>51, av. du Marechal de Lattre de Tassigny               94010  CRETEIL
>tel : (00 33 1) 49 81 21 79                fax : (00 33 1) 49 81 27 08
>secr.: (00 33 1) 49 81 23 82         m.el.:[email protected]
>
>
>
> > -----Message d'origine-----
> > De : Anthony Berglas [mailto:[email protected]]
> > Envoyé : mardi 19 août 2008 04:30
> > À : hkara1
> > Objet : Re: [SimpleORM] Re: New SimpleORM Whitepaper
> >
> > Hello Harry,
> >
> > I have uploaded the new version 3.0.  Is there any chance that you
> > will have time to have a look at it, and ideally upgrade?  This
> > involves a bit of tedious typing, but should be fairly fast.
> >
> > (The old version is on a branch and could be pached if necessary.)
> >
> > Anthony
> >
> >
> > >Hi,
> > >
> > >I welcome this change; I am heavily using Oracle with SimpleOrm
> > >(storing and serving a few ten of thousands of biological results in
> > >an 900 bed hospital), and every now and then, (once every month in
> > >average) Oracle entered in a deadlock. I resolved the problem by
> > >subclassing the Oracle driver and disabling locking, and then I
> > >used the modified driver.
> > >Otherwise SimpleOrm works quite well for me.
> > >
> > >Best regards,
> > >
> > >Harry
> > >
> > >
> >
> > Dr Anthony Berglas, [email protected]       Mobile: +61 4 4838 8874
> > Just because it is possible to push twigs along the ground
> > with ones nose
> > does not necessarily mean that is the best way to collect firewood.
> >

Dr Anthony Berglas, [email protected]       Mobile: +61 4 4838 8874
Just because it is possible to push twigs along the ground with ones nose
does not necessarily mean that is the best way to collect firewood.


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

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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.