|
From: Rod J. <rod...@in...> - 2003-06-08 18:30:41
|
> All things considered, a JDO or Hibernate interceptor can be used as an alternative to the respective template. Additionally specifying a TransactionInterceptor makes sense in almost every case. The JDO or Hibernate interceptor only adds actual value when used with JTA though, as the specific JDO or Hibernate transaction manager performs the required thread-binding anyway. It doesn't interfere though if still specified, provided that it properly checks for an existing thread-bound PM instance for the given factory. > Such interceptors for JDO and Hibernate should be pretty easy to implement. Effectively, the mechanism is a very simple delegation to PersistenceManagerFactoryUtils resp. SessionFactoryUtils: check for a thread-bound PersistenceManager resp. Session instance, open and bind a new one if necessary, call the business object method, unbind and close the instance afterwards if necessary. > After all that analyzing, I volunteer to develop the interceptors if you don't mind - I guess I'll be able to provide them at the end of next week, at the latest... So if there are some issues that I've missed, let's discuss them promptly. Generally, I consider appropriate best practices very important, especially in the fields of persistence. Thus, let's try to clarify all options and their value in various scenarios. I hope this, ehm, essay helps ;-) This summarizes my thinking on this. I certainly have no objection to you developing the interceptors! I have to start on my ServerSide Symposium talks this coming week, so I won't have much coding time. Regards, |