sorry, another point...
queryRunner parameter must be a QueryManager member parameter, you have to
remove "static"
Selon [EMAIL PROTECTED]:
> i'm seeing another point. Your QueryManager does not offer the guarantee to
> be a
> singleton, you have to declare a private constructor.
>
> Jérome.
>
>
> Selon [EMAIL PROTECTED]:
>
> > Selon [EMAIL PROTECTED]:
> >
> > > Hi,
> > > I'm using a dao pattern, the call
> > >
> > > QueryManager.getInstance().getQueryRunner().query(...);
> > >
> > > is executed in my dao object.
> > >
> > > Servlet calls dao method.
> > >
> > ok.
> >
> > > What do you mean with it depends of your project size?
> > Hi,
> > If you have a small project it is not mandatory to spend a lot of time in
> the
> > abstraction layers, but this is advised. If you implement this approach,
> life
> > is
> > wonderful. :)
> >
> > Jérome.
> >
> > >
> > > Thanks a lot
> > >
> > > Diego
> > >
> > >
> > > > 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]
> > > >
> > > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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]
> >
> >
>
>
>
> ---------------------------------------------------------------------
> 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]