Hibernate ORM, jOOQ, HikariCP, Transactions, and Spring: An SQL / CQRS Tutorial

When it comes to interacting with relational databases, citizens of the Java world tend to be in one of two camps.  Lately, the rift continues to widen.

  1. Use Hibernate ORM for all CRUD operations, all queries, and anything else that would otherwise touch SQL.  SQL is icky.  Abstract all the things.
  2. I got 99 problems and Hibernate ORM caused them all.  Es el Diablo.  Avoid it, no matter what.  Use nothing but pure SQL, as God himself intended.

Folks miss an important point: ORM was never meant to be used for everything!  It is a tool to be used where applicable.  Can it be used as a complete abstraction or replacement for everything involving the database, shielding developers from ever having to learn SQL?  For the most part, yes.  Should it be?  Definitely no.  It often makes sense to combine ORM with other SQL approaches, marrying the best of both worlds.

Continue reading Hibernate ORM, jOOQ, HikariCP, Transactions, and Spring: An SQL / CQRS Tutorial

Tutorial: Spring + Hibernate + HikariCP

HikariCP is newer JDBC connection pool, but has already gained a large following.  And for good reason!  It’s lightweight, reliable, and performant.

We recently added it as a core module to Hibernate ORM: hibernate-hikaricp (will be released in ORM 4.3.6 and 5.0.0).  However, I wanted to try and replace C3P0 within NeighborLink’s new web platform.  It’s been plagued with connection timeouts (regardless of the many iterations of config changes) and other quirks.  NL is based on Spring MVC and ORM (4.2.12), so in this setup, hibernate-hikaricp is a moot point.  We can simply feed the HikariCP DataSource implementation directly to the Spring LocalSessionFactoryBean.  Here’s my setup and configuration: Continue reading Tutorial: Spring + Hibernate + HikariCP

Hibernate ORM Presentations at DevNexus 2014

Frankly, Hibernate ORM has been missing from the conference scene for quite a while.  Starting this year, I’m attempting to make it more of a priority.  The framework has received many improvements and new features that are well-worth presenting.

I’ll be starting with two talks at DevNexus 2014 in Atlanta.  One focuses on Hibernate ORM tips, tricks, performance improvements, and common myths/misconceptions.  The other presents several powerful features provided by Hibernate, outside of the typical ORM/JPA space.  The abstracts are below.  I’d love feedback and requests! Continue reading Hibernate ORM Presentations at DevNexus 2014