Hi,
Thanks for your reply. It seems that your solution is more advanced
than I am trying to do. As I don't have much time to do redesign I only
want to get Cocoon's database connection from it pool in my DAO (not
avalon components classes)
Is it possible to call something like this in my DAO classes?:
ComponentSelector selector =
(ComponentSelector) manager.lookup(Roles.DB_CONNECTION);
datasource = (DataSourceComponent) selector.select("MyConnection");
Connection conn = datasource.getConnection();
conn.close();
>> My Cocoon project uses JavaBeans objects that act as business model e.g.
>> User, Article, Comment, etc. Every object has "data access object" that
>> handles database operations. Now i need to pass database connection to
>> these objects but I don't know how.
JH> My application appears to be very similar. I have a User and a UserDAO,
etc.
>> I'm using Cocoon's flow and know that I can get database connection in
flow
>> script but this didn't help me very much, because I would have to pass
>> connection to my beans in every function. The ideal would be that my
>> "database access" objects pulled the db connection from Cocoon. How to do
>> it?
JH> I'm not sure I totally follow but I'll give it a shot in hopes that it
might
JH> help or even possibly get comments on how I could do it better. This is
a bit
JH> watered down... I have a DaoContainer which gets set up in a
JH> ServletContextListener where the ServletContextListener reads some
database
JH> properties from a file. The ServletContextListener binds the
DaoContainer in
JH> JNDI. So when I need a, for example, UserDAO, I first get the
DaoContainer
JH> from JNDI. The watered down part is how a DaoContainer creates a UserDAO
but
JH> all DAOs are based on an AbstractDAO and since a DaoContainer (watered
down)
JH> creates all DAO, the DAO already has a database connection.
JH> There is http://jingdao.sourceforge.net/ which I tried but could not get
to
JH> work. This is how and why I ended up with what I coded, well at least
the
JH> class names and their concepts. I think the maintainer fixed the
problems I
JH> was having.
JH> I created a DaoTransformer so I could keep tansactions, etc out of the
JH> flowscript but today it is beginning to look I won't be able to do that
JH> forever. And I guess I am procrastinating ...
JH> Jim
Regards,
Mirko
________________________________________________
DARMOWE KONTA POCZTOWE ORAZ WWW -> WWW.OF.PL
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]