org.compass.spring
Class LocalCompassSessionBean
java.lang.Object
org.compass.spring.LocalCompassSessionBean
- All Implemented Interfaces:
- org.springframework.beans.factory.FactoryBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware
public class LocalCompassSessionBean
- extends Object
- implements org.springframework.beans.factory.FactoryBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware
A factory for CompassSession
that creates a special proxied
session which can be used within code that runs within an external transaction (Spring, JTA).
The session can be used without using Compass transaction management code or even without
closing the session.
It is optional to set the Compass
instance that will be used to create
the transactional Compass session. If there is a single Compass instance defined within the spring
application context, it will be automatically used.
- Author:
- kimchy
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LocalCompassSessionBean
public LocalCompassSessionBean()
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
- Specified by:
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
afterPropertiesSet
public void afterPropertiesSet()
throws Exception
- If no Compass instance was set, will try to use Spring application context
to get a Compass instance.
- Specified by:
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
- Throws:
Exception
setCompass
public void setCompass(Compass compass)
- Sets the Compass instance used to open session. It is optional
to set the Compass instance, since if there is a single instance
defined within the application context, it will be automatically used.
- Parameters:
compass
- The Compass instance to use for openning the session
getObject
public Object getObject()
throws Exception
- Specified by:
getObject
in interface org.springframework.beans.factory.FactoryBean
- Throws:
Exception
getObjectType
public Class getObjectType()
- Specified by:
getObjectType
in interface org.springframework.beans.factory.FactoryBean
isSingleton
public boolean isSingleton()
- Specified by:
isSingleton
in interface org.springframework.beans.factory.FactoryBean
Copyright (c) 2004-2009 The Compass Project.