Tuesday, July 21, 2009

See my pretty hammer...

It happened again.

I learned about a feature in OpenJPA that allows you to specify the fetch behavior exactly as you need it - fetch groups.

And, they are awesome.  My opinion doesn't carry much weight - but if it did, then fetch groups would be part of the JPA spec.

But like every tool - they should only be used when it is appropriate.

One reason that they should be used only as really needed is that in Apache Geronimo, casting a regular EntityManager to an OpenJPAEntityManager causes a new transaction to be started.

In itself that isn't necessarily so bad, but it does begin to clutter things if you use them excessively.  And, that is exactly what I did.

I took my shiny new hammer and started whacking everything.

Including my thumb.

Ouch.
Post a Comment