q0: every call to the dao creates a new connection?
A0: every DAO instance HAS-A connection object, perhaps from a pool. A connection object is usually open and usable. Before the link is established with the DB, the connection object probably doesn't exist.
q1: methods in the dao object?
get*() like getSomethingByPrimaryKey(int key)
insert*()
special methods? getConnection()?
q2: a single DAO or
teacherDAO, departmentDAO, courseDAO, projectDAO.. .?
A2: multiple is more common. Consider CMP.
A2: Even a daoFactory class should be defined for a particular db table like
CatalogDAOFactory.getDAO() -- static method
q3: where is sql stored?
a3: a studentDAO would expose many
getAge(), setNationality(), updateMatricYear(), insertCourse()... methods. Where do u think the sql is?
q: how is the connection obj created and passed?
a: The connection URL is often harded-coded in the dao (or dao-factory)
[lopri] q: singleton? probably not, we need many instances of DAO
[lopri] q: dao is an iface or ...?
A: We have seen simple cases, where interface is unnecessary.
[lopri] q: dao factory? not always necessary? how about in strusts?