brett@3riverdev.com 260.349.5732

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

Posted on July 2 , 2016

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.

(more…)

Apache Camel Processors Should NEVER Be Stateful

Posted on May 14 , 2016

If you have experience with Apache Camel, this one might sound a little obvious.  But, it has recently come up a few times, so it’s worth mentioning. As an example, say you have a route that iterates over paged data and does something with it, and you therefore need to keep track of the pagination. You might use something like the following:

(more…)

Apache Karaf on Vagrant (example Vagrantfile)

Posted on January 13 , 2016

If you have a team developing OSGi applications for Apache Karaf, Vagrant provides an easy way to ensure everyone is testing local deployments in a consistent context.  Vagrant is a little like Docker, using a layered approach to build up virtual environments.  In this case, we create an Ubuntu “box”, running on a VirtualBox VM, and automatically set it up with everything necessary for Karaf testing. (more…)

Apache Camel: Throw Exception from Sub-Route to Previous Route

Posted on December 30 , 2015

By default, each Apache Camel route has its own error handler, meaning each independently catches and handles Exceptions thrown within it.  But, what if a “parent route” needs to catch and handle Exceptions thrown by a sub-route?  Here’s one approach: (more…)

Find Transaction Leaks in Wildfly and JCA

Posted on December 29 , 2015

Here’s a quick tip: the easiest way to find transaction leaks in Wildfly/JCA.  In standalone.xml’s JCA subsystem, change

<cached-connection-manager/>
to
<cached-connection-manager debug=”true”/>

That will automatically close un-closed JCA connections and spit out a nice warning/stacktrace, showing exactly where the transaction was opened.

Tutorial: Spring + Hibernate + HikariCP

Posted on April 23 , 2014

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: (more…)

Man vs. JIRA: The 3,000+ Issue Tracker Fight

Posted on January 9 , 2014

What do you get from a 10+ year old open source framework, thousands and thousands of users within a wide range of roles, and tremendous complexity?  A JIRA project with over 3,000 unresolved tickets, ranging from the brand-new to a stale 8+ years.  Welcome to Hibernate ORM. (more…)

Posted in:

Hibernate ORM Presentations at DevNexus 2014

Posted on January 8 , 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! (more…)

Dear Open Source Project User: Quit Being A Jerk

Posted on January 25 , 2013

A few weeks ago, this article was circulating around in HackerNews and other social media: Dear Open Source Project Leader: Quit Being A Jerk

I 100% agree  with the author’s points.  Sometimes, open source project leaders can be seriously rude and elitist.  Ironically, the same projects beg for contributors “no matter the skill level or type of assistance”.  These two realities cannot happen simultaneously.

However, in my experience, the flip-side is frequently true as well: a subset of users will simply be…jerks.  So, here’s my quick plea:

Please remember that the project is open source and community driven.  Instead of saying “WHY HASN’T THIS BEEN FIXED YET?!”, actively dig in and fix it — especially for something simple.  Project committers are not the sole developers or owners; rather, we’re facilitators.  Shed the customer and consumer mentality and refocus on being a contributor.  Realize that your priorities and criticalities are not the same as others’.  And above all, lighten up; keep the communities friendly, polite, and fun.

Posted in: