Simulate @CompassContext in JEE
Friday, November 10th, 2006@CompassContext is a great feature when using Spring. It allows for simplification when using Compass API within a transactional context (like Spring managed transactions). If your application uses a different managed environment, like JEE, the @CompassContext session injection can still be simulated.
If we take JEE environment as an example, usually the Compass instance would be registered under JNDI. In order to create a CompassSession that will simplify its usage under managed environment, all that needs to be done is:
compassSession = CompassSessionTransactionalProxy.newProxy(compass);
Where compassSession is probably a class level instance (since it does not make sense to proxy CompassSession each time). Note, it is perfectly fine for CompassSession to be a class level instance, and the proxy will take cate of creating ones correctly based on the transaction context.

My name is Shay Banon, the founder of