The business layer and data access layer

J

java-john

I'm doing a 3 tier development (i.e. Presentation <-> Business <-> Data
Access). On the data access layer (DAL), I have factories that creates
the business objects. I have been researching and reading, the
literature seem to support passing in Connection objects into the DAL
from the business layer (BL); the idea is that the BL knows the
environment in which it is operating (i.e. Tomcat or stand alone).

My question is then, when I pass a Connection into the DAL from the BL,
how do I manage the opening and closing of the Connection? It is best
to open/close the Connection object in the same method, however, with
the advise that I pass in a Connection to the DAL, would I close it in
the DAL or BL?

If I pass in a DataSource into the DAL, now I shift the responsibility
of catching/throwing exceptions to the DAL, and I am not sure if this
is the least risky approach.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top