|
From: <jue...@we...> - 2003-07-23 11:17:36
|
Jean-Pierre, Thomas, Rod, everybody, I suggest to address the issue by offering overloaded execute and mapRow = methods with a "Map context" parameter (instead of "Object context"). = Additionally, I suggest to offer just one single MappingSqlQuery class = with 3 mapRow hooks: - mapRow(ResultSet rs, int rowNum, Map context, Object[] parameters) - mapRow(ResultSet rs, int rowNum, Map context) - mapRow(ResultSet rs, int rowNum) The default implementations of the former two could simply cascade = towards the latter. A subclass can choose to override any of those. This = mechanism is inspired by our SimpleFormController that offers similar = cascading methods for onSubmit. This would effectively mean dissolving MappingSqlQueryWithParameters and = merging it with MappingSqlQuery. As I assume that most people use = MappingSqlQuery anyway, this shouldn't pose a problem. All former = MappingSqlQueryWithParameters subclasses would simply have to extend the = merged MappingSqlQuery then. As I consider both a context map and a consolidation of all overloaded = mapRow methods into MappingSqlQuery sensible and straightforward = changes, I suggest to implement them promptly. I'm even willing to = include this in 0.9.1, to reflect the merging of = MappingSqlQueryWithParameters and MappingSqlQuery as early as possible. What do you think? Juergen -----Original Message----- From: jp....@ti... [mailto:jp....@ti...] Sent: Wednesday, July 23, 2003 10:08 AM To: j=FCrgen h=F6ller [werk3AT] Cc: springframework-developer Subject: Re: [Springframework-developer] Summary of pending points Hi Juergen, It's the second case. In fact, the locale is or is not used in the = request itself, depending if the root object uses it directly or not. The simpliest example is this one. Admitting a user or an address that = is classicaly not localized in the database. If this record contains a = Country indication, only the country code will still be stored in the = database. When mapRow will create the Country object with 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. As we said both, the locale cannot be a current execute parameter in = this case. The core of rewriting is done. Just the doc is not changed accordingly = and for the new feature, I have not rewrited convenience methods.=20 I will, when at home, put my current version of the three involved = classes in the sandbox. So you will be able to see what changes I've = made and if this way has to be changed. The changes are completely backward compatible. Currently only one test = breaks, but its only a lack of a constructor signature. Note: I have also attached these files in this mail. Regards, Jean-Pierre ---------- Initial Header ----------- From : j=FCrgen h=F6ller [werk3AT] <jue...@we...> To : "JP Pawlak" = <jp....@ti...>,<spr...@li...> Cc :=20 Date : Wed, 23 Jul 2003 09:27:53 +0200 Subject : Re: [Springframework-developer] Summary of pending points Hi Jean-Pierre, =20 <quote> >>> Ad 3) I haven't thought about that in depth, as I'm mainly using Hibernate these days. But it seems to me that simply using a MappingSqlQuery instance per request should solve the problem. It's not really about creating many such instances I guess, as they are pretty lightweight. Do you have a particular reason for wanting to reuse MappingSqlQuery instances in this case? You're right that using a new instance per request solves the problem. Nevertheless, it's not about a few particular requests, but almost all. In addition to the class creation, it's also the prepared statement re-creation and re-compilation. It's possible anyway that the gain is not so high. But as the job is done for me, I prefer continue to reuse as so it can only be faster and has no additional risk. </quote> =20 OK, I see that there is value in reusing the prepared statements. =20 What 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 method, but it = probably won't go into the statement as Locale object but rather as some = language code. So are you setting the Locale to the mapped object 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. =20 That would require adding a new context parameter of type Object or Map = to execute, newResultReader, and mapRow. There should be a solution to = do this as backward compatible as possible, maybe by introducing a super = class of MappingSqlQueryWithParameters called = MappingSqlQueryWithParametersAndContext? The two subclasses could still = offer the same mapRow implementations as before. =20 Regards, Juergen ********** L'ADSL A 20 EUR/MOIS********** Tiscali propose l'ADSL le moins cher du march=E9 : 20 EUR/mois et le = modem ADSL offert !=20 Pour profiter de cette offre exceptionnelle, cliquez ici : = http://register.tiscali.fr/adsl/ Offre soumise =E0 conditions. |