|
From: <jue...@we...> - 2004-03-30 07:28:50
|
+1 - sounds plausible to me
BTW, I'll be done for 1.0.1 soon, so it would be good to get this in =
promptly.
Juergen
-----Original Message-----
From: spr...@li...
[mailto:spr...@li...]On Behalf
Of Rod Johnson
Sent: Tuesday, March 30, 2004 8:09 AM
To: spr...@li...
Subject: Re: [Springframework-developer] SQLErrorCodesFactory Product
Name lookup
+1
----- Original Message -----
From: "Thomas Risberg" <tho...@tr...>
To: <spr...@li...>
Sent: Tuesday, March 30, 2004 3:54 AM
Subject: [Springframework-developer] SQLErrorCodesFactory Product Name
lookup
> I have been watching my logs and the constant lookup of the database
> product name is bothering me. Colin had the same issue a while ago, =
but
> we never really resolved it. I have a potential solution which =
entails
> storing the hash code of the datasource along with the retreived
> database product name in a static HashMap. Next time, before looking =
up
> the name we could check this HashMap and pull the name from there if =
it
> is found. Can anyone see a flaw in this solution? Any chance of two
> datasource objects having the same hash code? Any chance of a
> datasource switching to a different database while we are running?
>
> Here is the added code:
>
> public SQLErrorCodes getErrorCodes(DataSource ds) {
> // Lets avoid looking up database product info if we can.
> Integer dataSourceHash =3D new Integer(ds.hashCode());
> if (dataSourceProductName.containsKey(dataSourceHash)) {
> String dataSourceDbName =3D
> (String)dataSourceProductName.get(dataSourceHash);
> logger.info("Database Product found in cache {" +
> dataSourceHash + "}. Name is " + dataSourceDbName);
> return getErrorCodes(dataSourceDbName);
> }
> // We could not find it - got to look it up.
> logger.info("Looking up default SQLErrorCodes for =
DataSource");
> ... (this part is already there)
>
> Thomas
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> =
administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli=
ck
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli=
ck
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|
|
From: <rod...@in...> - 2004-03-30 13:15:56
|
>Well one solution of course (as mentioned at the time I brought this up) was to just use a premade JdbcTemplate which comes from the context, since it is of threadsafe. That's what I've always done, so I've never been bothered by the lookups. |
|
From: <tho...@tr...> - 2004-03-30 15:13:02
|
I noticed this while preparing for my JDBC presentation. All our samples preconfigure a DAO with a DataSource. Would it make sense to switch that to a preconfigured JdbcTemplate if that is the preferred way to work, or should we just make this proposed change and leave it at that? I made the change locally, but it broke a bunch of tests where the mock objects expected some calls for the meta data. I'll try to clean that up and check things in by tomorrow some time. Thomas Quoting rod...@in...: > >Well one solution of course (as mentioned at the time I > brought this up) > was to just use a premade JdbcTemplate which comes from the > context, > since it is of threadsafe. > > That's what I've always done, so I've never been bothered by > the lookups. > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > |
|
From: Colin S. <col...@ex...> - 2004-03-30 16:00:04
|
I think we should make the proposed change, then people can use JdbcTemplate either way. As for the samples, at that point, I personally think they can be left the same; pre-instantiating the template is no longer a preferred solution. It may in fact be less desireable since people have to pass in both a DataSource and JdbcTemplate to beans that need it, instead of just a DataSource. tho...@tr... wrote: >I noticed this while preparing for my JDBC presentation. All our samples >preconfigure a DAO with a DataSource. Would it make sense to switch that to a >preconfigured JdbcTemplate if that is the preferred way to work, or should we >just make this proposed change and leave it at that? > >I made the change locally, but it broke a bunch of tests where the mock objects >expected some calls for the meta data. I'll try to clean that up and check >things in by tomorrow some time. > >Thomas > > >Quoting rod...@in...: > > > >>>Well one solution of course (as mentioned at the time I >>> >>> >>brought this up) >>was to just use a premade JdbcTemplate which comes from the >>context, >>since it is of threadsafe. >> >>That's what I've always done, so I've never been bothered by >>the lookups. >> >> >>------------------------------------------------------- >>This SF.Net email is sponsored by: IBM Linux Tutorials >>Free Linux tutorial presented by Daniel Robbins, President and CEO of >>GenToo technologies. Learn everything from fundamentals to system >>administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click >>_______________________________________________ >>Springframework-developer mailing list >>Spr...@li... >>https://lists.sourceforge.net/lists/listinfo/springframework-developer >> >> >> > > > > > >------------------------------------------------------- >This SF.Net email is sponsored by: IBM Linux Tutorials >Free Linux tutorial presented by Daniel Robbins, President and CEO of >GenToo technologies. Learn everything from fundamentals to system >administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click >_______________________________________________ >Springframework-developer mailing list >Spr...@li... >https://lists.sourceforge.net/lists/listinfo/springframework-developer > > |
|
From: <sk...@fe...> - 2004-03-30 15:39:08
|
Hey Thomas, I just moved to Philadelphia and was thinking of high tailing it out to Villanova to see the presentation. If I don't make it good luck. Will you be putting some slides up on the spring site as well? I thoroughly enjoy raiding all of those presentations for my own training material, proper credits given of course. #;@) Sean Kroah FedEx Ground (412) 859-5130 sk...@fe... |---------+-----------------------------------------------------> | | tho...@tr... | | | Sent by: | | | spr...@li...| | | ceforge.net | | | | | | | | | 03/30/2004 10:13 AM | | | Please respond to | | | springframework-developer | | | | |---------+-----------------------------------------------------> >----------------------------------------------------------------------------------------------| | | | To: spr...@li... | | cc: | | Subject: Re: [Springframework-developer] SQLErrorCodesFactory Product Name lookup | >----------------------------------------------------------------------------------------------| I noticed this while preparing for my JDBC presentation. All our samples preconfigure a DAO with a DataSource. Would it make sense to switch that to a preconfigured JdbcTemplate if that is the preferred way to work, or should we just make this proposed change and leave it at that? I made the change locally, but it broke a bunch of tests where the mock objects expected some calls for the meta data. I'll try to clean that up and check things in by tomorrow some time. Thomas Quoting rod...@in...: > >Well one solution of course (as mentioned at the time I > brought this up) > was to just use a premade JdbcTemplate which comes from the > context, > since it is of threadsafe. > > That's what I've always done, so I've never been bothered by > the lookups. > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |
|
From: Keith D. <kd...@cs...> - 2004-03-30 16:21:56
|
:-) Hey yea Thomas, best of luck with your presentation! Keith -----Original Message----- From: spr...@li... [mailto:spr...@li...] On Behalf = Of sk...@fe... Sent: Tuesday, March 30, 2004 10:39 AM To: spr...@li... Subject: Re: [Springframework-developer] SQLErrorCodesFactory Product = Name lookup Hey Thomas, I just moved to Philadelphia and was thinking of high = tailing it out to Villanova to see the presentation. If I don't make it good = luck. Will you be putting some slides up on the spring site as well? I = thoroughly enjoy raiding all of those presentations for my own training material, proper credits given of course. #;@) Sean Kroah FedEx Ground (412) 859-5130 sk...@fe... |---------+-----------------------------------------------------> | | tho...@tr... | | | Sent by: | | | spr...@li...| | | ceforge.net | | | | | | | | | 03/30/2004 10:13 AM | | | Please respond to | | | springframework-developer | | | | |---------+-----------------------------------------------------> =20 >------------------------------------------------------------------------= --- -------------------| | | | To: spr...@li... | | cc: | | Subject: Re: [Springframework-developer] SQLErrorCodesFactory Product Name lookup | =20 >------------------------------------------------------------------------= --- -------------------| I noticed this while preparing for my JDBC presentation. All our = samples preconfigure a DAO with a DataSource. Would it make sense to switch = that to a preconfigured JdbcTemplate if that is the preferred way to work, or = should we just make this proposed change and leave it at that? I made the change locally, but it broke a bunch of tests where the mock objects expected some calls for the meta data. I'll try to clean that = up and check things in by tomorrow some time. Thomas Quoting rod...@in...: > >Well one solution of course (as mentioned at the time I > brought this up) > was to just use a premade JdbcTemplate which comes from the context, > since it is of threadsafe. > > That's what I've always done, so I've never been bothered by the=20 > lookups. > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of=20 > GenToo technologies. Learn everything from fundamentals to system=20 > = administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli= ck > _______________________________________________ > Springframework-developer mailing list=20 > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of = GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli= ck _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of = GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli= ck _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |
|
From: <jue...@we...> - 2004-03-30 16:14:01
|
Actually, passing in JdbcTemplate would be good enough, as it contains = its DataSource. JdbcDaoSupport is also implemented that way: You can = either pass in a DataSource *or* a JdbcTemplate. I'm still for leaving the example as-is, though: passing in a DataSource = is more natural, particularly for beginners, as JdbcTemplate remains an = implementation detail then that's not even visible in configuration. Juergen -----Original Message----- From: spr...@li... [mailto:spr...@li...]On Behalf Of Colin Sampaleanu Sent: Tuesday, March 30, 2004 6:00 PM To: spr...@li... Subject: Re: [Springframework-developer] SQLErrorCodesFactory Product Name lookup I think we should make the proposed change, then people can use=20 JdbcTemplate either way. As for the samples, at that point, I personally = think they can be left the same; pre-instantiating the template is no=20 longer a preferred solution. It may in fact be less desireable since=20 people have to pass in both a DataSource and JdbcTemplate to beans that=20 need it, instead of just a DataSource. tho...@tr... wrote: >I noticed this while preparing for my JDBC presentation. All our = samples >preconfigure a DAO with a DataSource. Would it make sense to switch = that to a >preconfigured JdbcTemplate if that is the preferred way to work, or = should we >just make this proposed change and leave it at that? > >I made the change locally, but it broke a bunch of tests where the mock = objects >expected some calls for the meta data. I'll try to clean that up and = check >things in by tomorrow some time. > >Thomas > > >Quoting rod...@in...: > > =20 > >>>Well one solution of course (as mentioned at the time I=20 >>> =20 >>> >>brought this up)=20 >>was to just use a premade JdbcTemplate which comes from the=20 >>context,=20 >>since it is of threadsafe. >> >>That's what I've always done, so I've never been bothered by=20 >>the lookups. >> >> >>------------------------------------------------------- >>This SF.Net email is sponsored by: IBM Linux Tutorials >>Free Linux tutorial presented by Daniel Robbins, President and CEO of >>GenToo technologies. Learn everything from fundamentals to system >>administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dc= lick >>_______________________________________________ >>Springframework-developer mailing list >>Spr...@li... >>https://lists.sourceforge.net/lists/listinfo/springframework-developer >> >> =20 >> > > > > > >------------------------------------------------------- >This SF.Net email is sponsored by: IBM Linux Tutorials >Free Linux tutorial presented by Daniel Robbins, President and CEO of >GenToo technologies. Learn everything from fundamentals to system >administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcl= ick >_______________________________________________ >Springframework-developer mailing list >Spr...@li... >https://lists.sourceforge.net/lists/listinfo/springframework-developer > =20 > ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli= ck _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |