From: Tobin Harris Date: 2002-05-20T03:29:10+09:00 Subject: Re: Object <-> Relational mapping Hi there Thomas, I posted a very similar question on comp.object (Relational Database Persistance, 12th May 2002) , which is just fading out after load or responses. Although people tend to go off on tangents somewhat, I did glean the following: Object Relational Mapping can be quite easy if you're not working against a legacy database. Basically, the database becomes an 'skip' in which class state (attributes) are stored. You can use reflection to automatically generate the database schema from the object model, and I was told that this can end up being quite normalised and freindly. Further maintenance from there involves tweaking the mapping files, but not too much major work apparently. Things get trickier where you can't use this approach. You have to do much more work - and I get the feeling this is the situation you're in. My perspective was this, which some people agreed was about right! "So you say you can do this with very little application code? How is this so? I have build a object mappers in Visual Basic (which is unfortunately what I'm working in at the mo). This worked will, but hardly required 'next to no code'. For example, I had to explicitly code what fields mapped to what columns for each object, where loading and saving. Also, I needed caching to prevent bi-directional relationships from causing objects to keep loading themselves. Finally, I had to put up with the trade-off of breaking encapulation so that the mapping layer could access the data that neede persisting in the objects. In the end, I'd say that I had almost as much mapping code as the objects themselves!" Since this topic is something that I'm still not settled with, I'd be interested to hear how you get on. I'm facing the same difficulties, so if I have any revelations I can share them with you. HTH Tobin Harris