|
From: Peng W. <wp...@gm...> - 2004-12-24 01:12:44
|
---------- Forwarded message ---------- From: Andrus Adamchik <an...@ob...> Date: Thu, 23 Dec 2004 18:53:28 -0500 Subject: Re: Configuring Cayenne with Spring (preview) To: cay...@ob... One last thing before I leave... http://objectstyle.org/downloads/cayenne/demos/cayenne-spring.tar.gz This is a first cut of Cayenne/Spring integration package. This download contains classes from "org.springframework.orm.cayenne" package, a few unit tests and a complete Spring PetClinic web application done in Cayenne. It is in a good enough shape, so when I get back from vacation I am planning to submit it to Spring project (don't know what is their current policy on accepting third-party integration packages; if they don't take them anymore, we'll release it in Cayenne). Supported features: * Recasting Cayenne exceptions to Spring DAO exceptions. Some of it is a bit artificial, as we don't have deep inheritance hierarchy of exceptions. Still it has its value, e.g. SQL exceptions are unwrapped and passed to Spring for further analysis. * CayenneTemplate - a Spring facade to DataContext that does DataContext "injection", exception handling, etc. Actually it is a pretty nice thing in itself... Template is stateless (relying on thread DataContext) and can be subclassed and customized to intercept various DataContext operations. * Automatic DataContext rollback on failures. There was a question about it on cayenne-user recently (http://objectstyle.org/cayenne/lists/cayenne-user/2004/12/0087.html). With CayenneTemplate this can be implemented as a policy (see "autoRollback" property). * WebInterceptor - a way to bind HttpSession DataContext to the request thread from Spring configuration. * ConfigurationFactory - a factory to load Cayenne project in Spring without relying on static Configuration (something that Cayenne does right now by default). ConfigurationFactory also supports overriding DataSource for all project DataNodes, so you can configure DataSource in Spring if you want to. Please let me know if anyone has any feedback. Andrus |