Hi,
It seems correct, why not, QueryRunner object is thread safe.
Web layer which calls integration layer directly, it's a bad design but this
depends of your project size.
Jérome.
Selon [EMAIL PROTECTED]:
> Hi, I'm developing a web application using DbUtils classes to execute
> queries and so on.
>
> I user QueryRunner class with a DataSource.
>
> I red this class is thread safe, so I implemented a Singleton to instance
> QueryRunner only once.
>
> This is my code:
>
> public class QueryManager {
>
> private static QueryManager queryManager = null;
>
> private static QueryRunner queryRunner = null;
>
> static {
> try {
> queryRunner = new QueryRunner(DataSourceSingleton.getInstance()
> .getDataSource());
> } catch (Exception e) {
> }
> }
>
> public static QueryManager getInstance() {
> if (queryManager == null) {
> queryManager = new QueryManager();
> }
> return queryManager;
> }
>
> public QueryRunner getQueryRunner() {
> return queryRunner;
> }
>
> In my servlets I use:
>
> QueryManager.getInstance().getQueryRunner().query(...);
>
> Is this correct?
>
> Which is the best practice to use QueryRunner in a web context?
>
> Thanks a lot in advance
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]