3 ms·
Nothing prevents you from using raw SQL queries with Hibernate. HQL is just a convenient superset.
by The_rationalist 6y ago
Nothing prevents you from using raw SQL queries with Hibernate.
HQL is just a convenient superset.
- nimchimpsky 6y agowhats the advantage of that ?
- karmakaze 6y agoActually mixing raw queries with JPQL/Hibernate queries is the worst of all worlds. To get it right, you will end up making explicit calls to let the EntityManager know what you want each side to be doing to play nice.
- The_rationalist 6y agoI've never hit such a bug. Can you expand on what (and when) added complexity would a raw query have versus a raw query without hibernate?
- karmakaze 6y agoIt's not a bug, it's by design.
- dopidopHN 6y agoI've seen that a lot in the past 10 years, and I don't find it particularly problematic. Often the fucked up native query end up in a different type of DAO for performance / concurency reasons anyway. Don't get me wrong, I dislike JPA and Hibernate really much, but that particular aspect has often been one of the less painful to deal with.