|
From: =?iso-8859-1?Q?<jp....@ti...> - 2003-07-23 08:08:05
|
Hi Juergen,=0D=0A=0D=0AIt's the second case. In fact, the locale is or is= not used in the request itself, depending if the root object uses it dir= ectly or not.=0D=0A=0D=0AThe simpliest example is this one. Admitting a u= ser or an address that is classicaly not localized in the database. If th= is record contains a Country indication, only the country code will still= be stored in the database. When mapRow will create the Country object wi= th the code from the database, it will need the locale, not of the record= , but of the user to serve. To allow the view displaying the name of the = country correctly.=0D=0A=0D=0AAs we said both, the locale cannot be a cur= rent execute parameter in this case.=0D=0A=0D=0AThe core of rewriting is = done. Just the doc is not changed accordingly and for the new feature, I = have not rewrited convenience methods. =0D=0A=0D=0AI will, when at home, = put my current version of the three involved classes in the sandbox. So y= ou will be able to see what changes I've made and if this way has to be c= hanged.=0D=0A=0D=0AThe changes are completely backward compatible. Curren= tly only one test breaks, but its only a lack of a constructor signature.= =0D=0A=0D=0ANote: I have also attached these files in this mail.=0D=0A=0D= =0ARegards,=0D=0AJean-Pierre=0D=0A=0D=0A=0D=0A=0D=0A---------- Initial He= ader -----------=0D=0A=0D=0AFrom : j=FCrgen h=F6ller [werk3AT] <juer= gen...@we...>=0D=0ATo : "JP Pawlak" <jp.pawlak@tiscal= i.fr>,<spr...@li...>=0D=0ACc = : =0D=0ADate : Wed, 23 Jul 2003 09:27:53 +0200=0D=0ASubject : Re: [S= pringframework-developer] Summary of pending points=0D=0A=0D=0AHi Jean-Pi= erre,=0D=0A =0D=0A<quote>=0D=0A>>> Ad 3) I haven't thought about that in = depth, as I'm mainly using=0D=0AHibernate these days. But it seems to me = that simply using a=0D=0AMappingSqlQuery instance per request should solv= e the problem. It's not=0D=0Areally about creating many such instances I = guess, as they are pretty=0D=0Alightweight. Do you have a particular reas= on for wanting to reuse=0D=0AMappingSqlQuery instances in this case?=0D=0A= =0D=0AYou're right that using a new instance per request solves the probl= em.=0D=0A=0D=0ANevertheless, it's not about a few particular requests, bu= t almost all.=0D=0AIn addition to the class creation, it's also the prepa= red statement=0D=0Are-creation and re-compilation. It's possible anyway t= hat the gain is=0D=0Anot so high. But as the job is done for me, I prefer= continue to reuse=0D=0Aas so it can only be faster and has no additional= risk.=0D=0A</quote>=0D=0A =0D=0AOK, I see that there is value in reusing= the prepared statements.=0D=0A =0D=0AWhat exactly are you doing with the= Locale inside the mapRow implementation? If you'd use it as an argument = for the prepared statement too, it could be a parameter of the execute me= thod, but it probably won't go into the statement as Locale object but ra= ther as some language code. So are you setting the Locale to the mapped o= bject but not using it directly for the statement? Then it couldn't be an= execute parameter, so you'd have to get it there in some other way.=0D=0A= =0D=0AThat would require adding a new context parameter of type Object o= r Map to execute, newResultReader, and mapRow. There should be a solution= to do this as backward compatible as possible, maybe by introducing a su= per class of MappingSqlQueryWithParameters called MappingSqlQueryWithPara= metersAndContext? The two subclasses could still offer the same mapRow im= plementations as before.=0D=0A =0D=0ARegards,=0D=0AJuergen=0D=0A=0A=0A***= ******* L'ADSL A 20 EUR/MOIS**********=0ATiscali propose l'ADSL le moins = cher du march=E9 : 20 EUR/mois et le modem ADSL offert ! =0APour profiter= de cette offre exceptionnelle, cliquez ici : http://register.tiscali.fr/= adsl/=0AOffre soumise =E0 conditions.=0A |