In the ODMG tutorial 2 below, an application class
performs db connect/open and passes
the odmg instance to the delete, edit, insert etc
classes.
In a web app where I have several tables to
update, insert, etc. where can I put the
connection?
Do I need to close the connection? Is the
connection always on?
Can I check if odmg and db are null before I
obtain the instance or open the db?
Thanks,
Ethel
public Application()
{
// get odmg facade instance
Implementation odmg = OJB.getInstance();
Database db = odmg.newDatabase();
//open database
try
{
db.open("repository.xml",
Database.OPEN_READ_WRITE);
}
catch (ODMGException ex)
{
ex.printStackTrace();
}
useCases = new Vector();
useCases.add(new UCListAllProducts(odmg));
useCases.add(new UCEnterNewProduct(odmg));
useCases.add(new UCDeleteProduct(odmg));
useCases.add(new UCQuitApplication(odmg));
}
--
To unsubscribe, e-mail: <mailto:ojb-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>