You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by sa...@women-at-work.org on 2005/03/14 22:48:06 UTC
Where to call _RootDAO.initialize()
Hello everyone!
Trying to use the Hyberclipe generated classes within my tapestry
application.....
Where do I call _RootDAO.initialize() ?
And when do I need to call it? Only when the whole web applications
is starting up?
So far the database layer was simple and taken from an old example:
A static class called ConnectionService and once called Persistance Service.
Example:
public static String getHomepage(int uid, String uname, String domain) {
String value = null;
Connection conn = ConnectionService.getConnection();
try {
String query = "select homepage from fb_homepages where uid=? and
approved='y'";
PreparedStatement stmt = conn.prepareStatement(query);
stmt.setInt(1, uid);
ResultSet result = stmt.executeQuery();
if (result.next()) {
value = result.getString(1);
}
}
catch (SQLException ex) {
ConnectionService.closeConnection(conn);
}
ConnectionService.closeConnection(conn);
if (value == null) {
value = "http://".concat(domain).concat("/").concat(uname);
}
return value;
}
How would it look ilke with a Hiberclipse/Hibernate Synchronizer generated
class with http://www.binamics.com/hibernatesync ?
Within a test class I could access it like that:
_RootDAO.initialize();
HomepagesDAO dao = new HomepagesDAO();
List homepages = dao.find("from Homepage as homepage ....");
And can I genereally just access those classes like that or do I need to
care about sessions, transactions and factories too?
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Where to call _RootDAO.initialize()
Posted by Alexey Romanchuk <ui...@gorodok.net>.
Hola!
sswawo> Hello everyone!
sswawo> Trying to use the Hyberclipe generated classes within my tapestry
sswawo> application.....
sswawo> Where do I call _RootDAO.initialize() ?
usually a call in in my servlet class in init function. another way is
call it in static area.
Alexey Romanchuk
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org