NHibernate version:1.0.2
Hello,
I have a question about session.refresh() function. Assume we have a graph of objects in memory:
1. On top there is object A, which has set of objects B and each object B has set of object C.
2. We load object A (set of objects B is lazy initialize). Then we initialize this set and, as it's not too large, we initialize also set of objects C in each object B.
3. This creates us a graph of objects.
Session is opened before each operation and closed just after it is finished.
My question is: if I'll call session.refresh() on object A - will graph remains consistent? Or object A will be replaced and references between object will be lost?
In "Java persistence with Hibernate" we can find:
Code:
Before you add refresh() calls to your application, we have to tell you that the
primary goal of the previous section was to show you when to use refresh().
Many Hibernate beginners don’t understand its real purpose and often use it
incorrectly. A more formal definition of refresh() is “refresh an in-memory
instance in persistent state with the current values present in the database.”
So I suppose that only values will be restored if needed and graph of object will remain unchanged - am I right?
Best regards,
tytus
Best regards,
tytus