Hi,
I've read the manual about services, but don't get it: It's like seeing the
puzzle pieces, but not the whole. Can someone explain it to me please,
especially:
1. How can I use a service to connect to my database? Or should I use
Hibernate?
2. How can I use a service to access the file system? In the demos,
Howard uses a service to access his CD library, and it seems really cool,
but I have no idea how he does it...
More specifically, I had a struts2 MVC webapp which I'm porting to T5. It
had three layers: JSP, which maps nicely to HTML templates, Controllers,
which are myTapestry components and pages, and my DAL, which is still there.
So for every serious class that I need to persist, it has a DAO that does it
for me e.g.:
public WhateverDAO() {
dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(Globals.dbDriver);
dataSource.setUrl(Globals.dbURL);
dataSource.setUsername(Globals.dbUsername);
dataSource.setPassword(Globals.dbPassword);
...
}
public List<QandA> retrieve(long poId) throws SQLException {
JdbcTemplate jt = new JdbcTemplate(dataSource);
...
}
This does not seem to be the Tapestry way, but can someone show me the true
path :-) A service seems to be the answer... or Hibernate, but I'm not sure
whether that will save me a lot of time.
Thanks,
Erik