If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

What problem is object persistence and ORM solving?

Hi,

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.