Intro
I'm the newest guy on my development team. We primarily do Java web development and work with Oracle databases, but on rare occasion we work with other RDMSs. In the interest of expanding my professional knowledge and exploring more modern methodologies, I decided to learn Hibernate.
So far, I'm unsure if its a good fit within our team - but I can't tell if that's because Hibernate legitimately does not suit our needs or because we follow such bad practices that Hibernate is "unwilling" to come along.
For example, virtually all of our interaction with the database is through standard JDBC CallableStatements and stored procedures. We iterate through ResultSets and place them into beans/pojos for the web app's use. Hibernate, from what I can tell, instead likes to exactly model tables (@Entity
, @Table
) and their columns. For simple SELECT
queries, this is a mildly simpler approach. However, For elaborate DB work (think running analytics on the raw data), I'm either stuck with manipulating the data in my Java code heavily (and abandoning the entity-classes that map tables eventually) or calling stored procedures via an ugly session.doWork
, which seems to defeat the entire point of using Hibernate to begin with.
Assumptions I have no clue about: My team told me early on that they think its better to do "heavy lifting" in the database (i.e. stored procedures) rather than in the app server (i.e. Java), and I have no idea if they're right or wrong. If they're right, then why do ORMs like Hibernate exist?
Also, I've heard that Hibernate has a pretty stiff learning curve, but I feel like I'm missing the point entirely. Are database tables supposed to exactly mimic the data you need in the web app? Is our design methodology that far gone?
Finally, I know stored procedures vs ORMs is a hot topic, but the trend seems to be on ORM's "side." Why?
tl;dr Hibernate appears to only help our use-case in the most trivial of cases, with a bunch of complicated configuration and extra resources as a trade-off. What am I missing?