Results 1 to 2 of 2

Thread: sessionFactory or hibernateTemplate is required

  1. #1
    Join Date
    Jul 2012
    Posts
    1

    Default sessionFactory or hibernateTemplate is required

    what's the hell of this?
    Server Error in '/' Application.




    sessionFactory or hibernateTemplate is required




    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.*




    Exception Details: System.ArgumentException: sessionFactory or hibernateTemplate is required




    Source Error:*




    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.




    ==========================code==================== =============
    public class BaseRepositoryImpl<T> : HibernateDaoSupport, IBaseRepository<T> where T : IEntity
    {
    private ISessionFactory sessionFactory;

    public ISessionFactory SessionFactory
    {
    protected get { return sessionFactory; }
    set { sessionFactory = value; }
    }
    ...
    }


    public class NewsRepositoryImpl : BaseRepositoryImpl<News>, INewsRepository {....}

    <object id="nr" type="xxxxx.Repository.Impl.NewsRepositoryImpl, xxxxx.Repository" singleton="false">
    <property name="SessionFactory" ref="sessionFactory"/>
    </object>

  2. #2
    Join Date
    Aug 2005
    Location
    Tampere, Finland
    Posts
    159

    Default

    Your BaseRepositoryImpl seems a bit off as HibernateDaoSupport already has SessionFactory member. If you inject this base property there shouldn't be an error as template is created based on session factory.

    -Marko

Posting Permissions

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