Results 1 to 2 of 2

Thread: Problem with Lazy fetching strategy

  1. #1
    Join Date
    Oct 2004
    Location
    Paris (France)
    Posts
    26

    Default Problem with Lazy fetching strategy

    'm setting my fetch association mapping to lazy in order to reduce database load.
    Doing so gives me the flexibility to change fetchMode of associated entities at runtime
    through the criteria api.

    The problem I'm having is when I try to load my entity itself.
    I'm getting an exception (see the extract below)

    here is my load code:

    public TStructure findById(String codeStructure) throws FinderException
    {
    TStructure result=null;
    try
    {
    result=(TStructure)getHibernateTemplate().load(TSt ructure.class,codeStructure);
    }
    catch (DataAccessException e)
    {
    String errorMessage=" Echec du chargement de la structure"+codeStructure;
    log.error(e+errorMessage);

    throw new FinderException(errorMessage,e);
    }
    return result;
    }


    here is the exception :

    ERROR [LazyInitializer] Exception initializing proxy
    net.sf.hibernate.HibernateException: Could not initialize proxy - the owning Session was closed

    Can someone tells me how I could load my item without changing the lazy fetch mapping mode.

    thanks in advance

  2. #2
    Join Date
    Feb 2005
    Location
    Eskisehir, Turkiye
    Posts
    16

    Default

    could you send spring configuration file and hibernate mapping files?

Similar Threads

  1. Replies: 4
    Last Post: May 26th, 2005, 05:44 PM
  2. fetching strategy Problem
    By meissa in forum Data
    Replies: 9
    Last Post: Mar 23rd, 2005, 09:23 AM
  3. Lazy load problem
    By frank huang in forum Data
    Replies: 3
    Last Post: Feb 1st, 2005, 03:21 AM
  4. Replies: 9
    Last Post: Jan 10th, 2005, 10:21 AM
  5. Lazy Load Problem when Doing UnitTest
    By yoshi in forum Data
    Replies: 7
    Last Post: Sep 29th, 2004, 10:00 AM

Posting Permissions

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