Around 10 years ago, a work collegue improved the ETL processing time of a Java application from minutes to a couple of seconds, by dropping hibernate and using direct JDBC instead.
If all one is doing is calling createNativeQuery() all the time, and having stored procedures as well, then it is just needless fat.
Re:To ORM or Not to ORM
by stickfigure on Wednesday May 08, 2019 @02:42AM
(#19856420)
If you have a trivial app that just executes a couple queries, then sure use JDBC?
I do not understand your point. Most business apps are not trivial.
Who said anything about it being a trivial app?
It was an ETL stack for distributed networking monitoring, and data reporting.
Re:To ORM or Not to ORM
by stickfigure on Wednesday May 08, 2019 @10:38AM
(#19859201)
If you can comfortably use JDBC for data access, then your data access logic isn't very complicated. There's nothing wrong with that; use the right tool for the job.
Re:To ORM or Not to ORM
by alexnewman on Thursday May 09, 2019 @10:19AM
(#19868496)
I believe the exact opposite
Who said it wasn't complicated?
Using SQL with JDBC isn't a synonym for bare bones string concatenation.
Offload complex queries to external files, or better yet, stored procedures.
But Hibernate will add extra complexity by it self. You can make mistakes in de mapping, then it adds multiple caches and you might use Spring and use the open-in-view filter...
I am not stating that Hibernate (or JPA for that matter) is bad but it totally depends on what you are developing. Simple solutions can use Hibernate for more complex stuff you might not.
Using JPA can also make your application independent from a specific database. But if you want to use advanced database features and have chosen a specific database you can not always use JPA.
...like, say, Hibernate.
I have a reasonably mature Hibernate app. It is almost exactly as easy to type createNativeQuery() as it is to type createQuery(). Many simple queries are shorter in JPQL, but for anything complex I always use SQL. I never feel like Hibernate is keeping me apart from the database.
I genuinely think most people who bash ORMs just haven't gotten far enough in their SQL learning curve that they get tired of writing the same dumb I/O code over and over. ORMs never "freed you from SQL", they just freed you from boilerplate. Even venerable and much-maligned ORMs like Hibernate.