Hi All,

I have the requirement.
I have a simple job contain tasklet that Connected to my default datasource name arun4. In the tasklet need to validate the input data and also i need to get the security information from my security datasource.

How can i use same class to connect to my security datasouce while calling by retrieveSecurityDetails DAO.

Code:
public class HibernateCurrentSessionFactoryBatch extends HibernateCurrentSessionFactory {
    
    /** Containing Logger for this Class. */
    private static final Logger LOGGER = Logger.getLogger(HibernateCurrentSessionFactoryBatch.class);
    
    /** Creating an instance sessionFactory for the Static SessionFactory class. */
    private SessionFactory sessionFactory;
    
    /**
     * Sets the session factory.
     * 
     * @param sessionFactory
     *            the sessionFactory to set
     */
    public void setSessionFactory(SessionFactory sessionFactory) {

        this.sessionFactory = sessionFactory;
    }
    
    /**
     * Retrieves the session object bound to the current thread.
     * 
     * @return Session, a session is retrieved from the sessionFactory.
     */
    public synchronized Session getCurrentSession() {

        LOGGER.debug("Enter getCurrentSession.");
        
        Session currentSession = SessionFactoryUtils.getSession(sessionFactory, true);
            
        LOGGER.debug("Exit getCurrentSession.");
        
        return currentSession;
        
    }
My bean's

Code:
<bean id="mySessionFactory"
		class="my.application.batch.core.dao.hibernate.HibernateCurrentSessionFactoryBatch">
		<property name="sessionFactory">
			<ref bean="batchSessionFactory" />
		</property>
	</bean>

<bean id="securityBatchSessionFactory"
		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
...
</bean>
the batchSessionFactory connects to my default datasource name arun4. How to override HibernateCurrentSessionFactoryBatch with the securityBatchSessionFactory for a particular DAO call alone?

Thanks for your reply in advance.