Alexander Kolesnikov
"Tapestry 5: Building Web Applications"
query(
new Predicate
()
{
public boolean match(Celebrity celebrity)
{
return celebrity.getId() >= indexFrom &&
celebrity.getId() <= indexTo;
}
});
return result;
}
}
Appendix B
[ 257 ]
To make sure our application uses the new data source, not the mock one, we need
to modify the AppModule class like this:
public void contributeApplicationStateManager(
MappedConfiguration
configuration)
{
ApplicationStateCreator creator =
new ApplicationStateCreator()
{
public IDataSource create()
{
return new ObjectDataSource();
}
};
configuration.add(IDataSource.class,
new ApplicationStateContribution("session", creator));
}
The new data source is ready, and now the newly added celebrities will not
disappear after the application's restart??”this is a proper database, after all!
Of course, such a brief demonstration could not cover all, or even the most
significant features of db4o. This database, with its transactions management and
client/server mode of operation, is perfectly able to serve the needs of a real-life,
enterprise-scale application. I encourage you to read the documentation that comes
with db4o.
Pages:
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315