|
From: Juergen H. <ju...@in...> - 2005-05-04 13:57:58
|
Hi everybody, In case you've been wondering what I was working on so busily... we now have fully integrated TopLink support in our CVS, including a TopLink implementation of PetClinic's persistence layer :-) Many thanks to Jim Clark from Oracle who implemented the original version, and of course to Oracle for granting the submission! It's modeled somewhat analogously to our Hibernate support, although with the important difference that we use a custom SessionFactory interface for TopLink (because TopLink does not define such a resource out of the box). There are the usual suspects: LocalSessionFactoryBean, TopLinkTemplate, TopLinkCallback, TopLinkTransactionManager. I've documented the TopLink data access operations quite extensively, because the semantics are significantly different from Hibernate's. For example, TopLink uses a shared object cache as second-level cache, in contrast to Hibernate and JDO which only hold flat data there. This leads to some very important differences in the lifecycle of persistent objects. An important distinction is between working with a TopLink Session (read-only) and working with a TopLink UnitOfWork (write operations). Of course, our TopLink support allows for both in callback style. The convenience operations defined on TopLinkTemplate allow for working with both too, either implicitly determined through the current transaction status or explicitly determined through a "enforceReadOnly" argument. Notably, there is *no* OpenSessionInViewFilter or OpenSessionInViewInterceptor for TopLink: it is simply not necessary. TopLink will automatically apply appropriate lazy loading, whether within an active Session or outside of it. Aside from the deployment-ready TopLink persistence layer, the "petclinic" directory also contains the TopLink Mapping Workbench project that the mapping XML file was created with. You can simply open the project file in with any TopLink Mapping Workbench implementation and have a visual few on the mappings. For licensing reasons, we only ship a toplink-api.jar that we can compile against. To run the PetClinic web application or its test suite, a full toplink.jar and xmlparserv2.jar (both from the TopLink distribution) need to be dropped into the "lib/toplink" directory (or the deployed "WEB-INF/lib" directory). Finally, PetClinic's TopLink layer is currently not able to properly insert objects, due to TopLink's default HSQLPlatform implementation: we need a special subclass of this to leverage HSQLDB's identity columns. Such a subclass is already committed but not fully active yet, simply because we need some additional methods exposed in our toplink-api.jar to be able to compile it. This should be resolved by tonight; everything else should already work! Juergen |