What problem is object persistence and ORM solving?
I have some experience with OOP (Java, C#) and RDBs, but very little exposure to web programming. I am trying to understand what problem object persistence and ORM solves. Of course, I am familiar with the need for data persistence, but I have never encountered a need for object persistence.
I am not asking about the process of persisting an object to a database and resurrecting it later. I am not asking about why ORM frameworks are useful for doing this or a pain in the butt for doing this. I am particularly interested in how the need arises to map/persist relationships between objects.
I have seen many examples of persisting POJOs to a database, but the examples all seem to be for very simple objects that are essentially nothing more than records anyway: a constructor, some private fields, and getter/setter methods. This example:
offers such an example, but goes on to discuss the mismatch issues of granularity, inheritance, identity, associations, and navigation, which are not motivated by the example.
If someone could offer a toy example of an instance where, say, an inheritance relationship needs to be persisted, I would be grateful. This might be blindingly obvious for anyone who has already encountered this situation but I have not and a great deal of searching and reading has not turned up any examples.
Whoops, I just realized thread is ultimately under "Client-Side Development." I was looking for an "ORM" or "Frameworks" thread, which do not exist, and finally settled on "General" by default without double checking the hierarchy. Clearly this is not a client-side issue but there is no way to delete this thread and repost it elsewhere. Apologies.
Consider it moved.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)