I think that you have already identified the main compromise associated with ORM software. Each time you add a new level of abstraction that tries to provide a generalized implementation of what you did manually, there will be some loss in performance / efficiency.
As you noted, moving multiple relationships, such as abcd , can be inefficient, as most ORM programs will perform an independent database query for each . along the way. But I'm not sure that you should completely eliminate ORM. Most ORM solutions (or at least, of course, Hibernate) allow you to specify custom queries where you can return exactly what you want in a single database operation. It should be about as fast as your dedicated SQL.
Actually, the problem is understanding how the ORM layer works behind the scenes, and understanding that while something like abcd easy to write, what it makes the ORM layer to do as it is being evaluated is not. As a rule, I always take the simplest approach to getting started, and then write optimized queries in areas where it makes sense /, where it is obvious that a simple approach will not scale.
source share