Link to home
Start Free TrialLog in
Avatar of nicolas_maujean
nicolas_maujean

asked on

Does the function clear for hibernate delete the elements the we get in a list ?

Hi,

   I have a code looking like that :

try    {
q = Query
ArrayList list = q.list()
} catch {
} finally {
session.clear()
}

  I would like to know if the session.clear will empty the list we previously created from a query

Thanks for your answer,

Nicolas Maujean
Avatar of girionis
girionis
Flag of Greece image

I would like to know if the session.clear will empty the list we previously created from a query

I do not think so. Clearing the session empties the queue updates that wait to happen on the objects in the session. And also removes instances from the cache. When you "clear" all updates that were not flushed are lost. I think that the objects themselves are not lost (they are still referenced by the Session object).
Avatar of nicolas_maujean
nicolas_maujean

ASKER

interesting answer, need to be sure the answer is good
ASKER CERTIFIED SOLUTION
Avatar of girionis
girionis
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial