How many people do not use ORM frameworks and why?

ORM are a double edge sword. You might think it is easy to start with and save a lot of development time, but the reality is that you have to be very experimented to use them properly. The JPA spec is of little help as not only it is incomplete, but the various implementations are so bug riddle that you'll end up cherry-picking features that works best with the selected vendor.

Most people use them incorrectly, putting the annotations and storage logic on their domain model rather than having dedicated DTO for it. And you'll see that they usually do the same mistake with the MVC pattern by reusing the same domain objects as the M of MVC. That might work, but only if your application is ridiculously simple (as those scaffolding examples in any "getting started" tutorial of every single framework) or with very little workload.

ORMs are usually good at two aspect of CRUD: the creation and deletion of objects. Using them for updates is already making for trouble, but using them for reading generally ends up spending more time trying to get it right than using plain SQL. The reason is that you need to understand not only the outdated SQL 92 (because ORMs want to be compatible with most of the databases), but also the implications of the relationship you describe in you model, the two levels of cache that the ORM provides, te various way to create your ORM query (JPQL, query builder, QBE,...) as well as the bugs and special optimisation of your specific implementation.
Knowing that most application will not want to use effective deletes, you are left with creates operations and some update ones.

Does that means that you shouldn't use them and use SP's all over the place instead? Not at all. Most applications will benefits of applying some sort of CQRS patterns, which generally implies that you'll have 2 kinds of DTO's for persisting you domain models. One that will benefit of using ORM for storing your model, and another that can fully leverage of the power modern SQL and provide better tailored queries. It does not implies to write SP's. Most of the time SQL will be just fine, and with support of tools like MyBatis, or the wonderful JOOQ library, you can be really productive too.

Regarding SP's, there definitively some use cases where they will be significantly better, but they came at a huge price in terms of maintenance, readability and testing.

/r/java Thread