Results 1 to 2 of 2

Thread: Setting the Session of getHibernateTemplate()

  1. #1

    Default Setting the Session of getHibernateTemplate()

    Hello

    Can I tell getHibernateTemplate() to use a specific session instead of the one given to the doInHibernate constructor ?

    In the following sample :

    HibernateCallback callback = new HibernateCallback() {
    public Object doInHibernate(Session s) throws HibernateException, SQLException{
    Session dom4jSession = s.getSession(EntityMode.DOM4J);
    for(Iterator it=nodes.iterator(); it.hasNext(){
    getHibernateTemplate().saveOrUpdate(beanref,it.nex t());
    }
    return code;
    }
    };

    I would like getHibernateTemplate() to work with the dom4jSession, instead of a default one. How should I do this ?

    Thanks

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,104

    Default

    Can I tell getHibernateTemplate() to use a specific session instead of the one given to the doInHibernate constructor ?
    I don't think so. The session's implicit handling (cleanup and transactions) won't be applied to your session. If this doesn't matter in your case it might be OK.

Similar Threads

  1. OpenSessionInView and portlet support
    By garpinc2 in forum Web Flow
    Replies: 31
    Last Post: Apr 9th, 2010, 11:12 AM
  2. OpenSessionInView + CMT Session usage
    By alesj in forum Data
    Replies: 7
    Last Post: Aug 16th, 2005, 02:32 AM
  3. Loosing my SecureContext
    By sklakken in forum Security
    Replies: 3
    Last Post: Jul 21st, 2005, 01:44 PM
  4. Replies: 1
    Last Post: Mar 12th, 2005, 04:33 AM
  5. Replies: 3
    Last Post: Nov 19th, 2004, 07:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •