Ike said:
If I serialize an ArrayList to disk, soes it also serialize the objects in
the ArrayList? And if so, why would I opt for using, say, Hibernate, to
persist an ArrayList, as opposed to just Serializing it ? Thanks, Ike
Serializing an ArrayList (or HashMap, etc) serializes everything reachable
from that starting point (not counting transients and objects already
serialized.) The resulting encoding (binary, XML, whatever) can easily be
stored and retrieved, but is difficult to work with--search, query, modify.
To do anything meaningful with it usually means you have to totally
deserialize it.
If all your system needs to do is to store and retrieve opaque objects,
that's ok--I've built a number of systems like that. However, Hibernate
(and other persistence tools) store object to a relational database in way
that makes the object structure visible and accessible to other relational
operations. You can search and manipulate the data as tables and then
reconsitute the revised objects. Just being able to perform relational
queries over the objects makes this technique worthwhile.
Cheers,
Matt Humphrey (e-mail address removed)
http://www.iviz.com/