I can't speak for other ORM's, just Hibernate (for Java).
Hibernate gives me the following:
- Automatically updates schema for tables on production system at run-time. Sometimes you still have to update some things manually yourself.
- Automatically creates foreign keys which keeps you from writing bad code that is creating orphaned data.
- Implements connection pooling. Multiple connection pooling providers are available.
- Caches data for faster access. Multiple caching providers are available. This also allows you to cluster together many servers to help you scale.
- Makes database access more transparent so that you can easily port your application to another database.
- Make queries easier to write. The following query that would normally require you to write 'join' three times can be written like this:
- "from Invoice i where i.customer.address.city = ?" this retrieves all invoices with a specific city
- a list of Invoice objects are returned. I can then call invoice.getCustomer().getCompanyName(); if the data is not already in the cache the database is queried automatically in the background
You can reverse-engineer a database to create the hibernate schema (haven't tried this myself) or you can create the schema from scratch.
There is of course a learning curve as with any new technology but I think it's well worth it.
When needed you can still drop down to the lower SQL level to write an optimized query.