The problem is we have to use a legacy database that is not normalized and it is very tedious to work with. We are accustomed to using Object-relational Mapping for implementing the Repository layer including the database so that it's easier and efficient for developing. But this time it became quite unable to utilize it.
The ideal answer (to me) would be " normalize the database first". But I know that real life often collides with my ideals. Re-design an existing database is likely to be out of the scope of any Web App development. It's possible but it depends on many things, being time and money the main constraints. Knowledge is next on that list and convenience following close.
So, I have to adapt myself to the circumstances and I choose the lesser evil. "I will let the database as is, and I will look for a flexible tool to abstract that mess from the source code".
What we found so far to be a solution, is to use native queries and manually mapping the value to POJO or DTO from the queries. But of course, this leads to more maintenance and complexity brought by manually performing queries considering also the database relationships.
ORMs are not way better than you at building performant queries1, overall if the database is not normalized and you have to make weird relationships by columns of different types and things like that.
You can write as good or better queries than any ORM, and the most important is that you can write the precise query you need for each situation. But you are right, ORMs brings a lot of abstractions and reusable solutions that save us time and headaches.
But, not all is lost. There are other ORMs, no so sophisticated (I'm afraid) but based on convention over configuration as those you are probably used to. These ORMs let you declare native SQL statements (even dynamics) and map results to DTOs. The first that comes to mind is MyBatis which is also integrated with Spring Boot. It's compatible for non-Spring Boot as well. You will find a lot of guides and tutorials to make it work.
If it's integrated with Spring, you get all the advantages of the Transaction Management too.
1: they are good at building and executing a lot of them, over and over