Results 1 to 3 of 3
  1. #1
    voipp is offline Member
    Join Date
    Oct 2013
    Posts
    51
    Rep Power
    0

    Lightbulb loading on demand in a new session

    Hello!
    Consider getting a collection of entities within an opened session. We only get collection , but not loading data from it(by performing load operations:e.g. iterate on collection). After close and open session again, i try to load data by exception occure. I suppose session must be the same for loading data, but why it is ?

  2. #2
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,869
    Rep Power
    5

    Default Re: loading on demand in a new session

    Well imagine your phone connection dropping while you are calling someone; as soon as it is up again, what do you need to do? Place the call new to re-establish contact with whomever you were speaking to.

    The same here; by closing the session you severe Hibernate's ability to fetch more data on demand. So in order to restore that ability, you need to re-establish the connection; by attaching the entity to the new Hibernate session / JPA context.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    voipp is offline Member
    Join Date
    Oct 2013
    Posts
    51
    Rep Power
    0

    Default Re: loading on demand in a new session

    Quote Originally Posted by gimbal2 View Post
    Well imagine your phone connection dropping while you are calling someone; as soon as it is up again, what do you need to do? Place the call new to re-establish contact with whomever you were speaking to.

    The same here; by closing the session you severe Hibernate's ability to fetch more data on demand. So in order to restore that ability, you need to re-establish the connection; by attaching the entity to the new Hibernate session / JPA context.
    I see... And one more question, im reading about
    context
    , more: about binding session to context. What is purpoise of it? Why do we need
    <property name="hibernate.current_session_context_class">thr ead</property>
    hibernate property ?

Similar Threads

  1. Great Demand For IT Professionals.
    By avularamesh4u in forum Jobs Discussion
    Replies: 2
    Last Post: 12-30-2008, 05:05 PM
  2. What are the hot java frames works on demand
    By mallaravi in forum Web Frameworks
    Replies: 1
    Last Post: 10-28-2008, 01:34 PM
  3. On demand Agile Development
    By ivank2139 in forum Java Software
    Replies: 0
    Last Post: 07-24-2008, 04:00 AM
  4. On demand Web Appilication Design
    By dbakumar@gmail.com in forum Web Frameworks
    Replies: 0
    Last Post: 10-29-2007, 05:23 AM

Tags for this Thread

Posting Permissions

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