TableGenerators and Sequencing

So I learned today that your persistence.xml may have both a <jta-data-source> and a <non-jta-data-source> specified alongside each other. I’m not sure why I thought these were mutually exclusive but I figured someone else probably had this misunderstanding as well.

(I also was reminded of the fact that JDBC does not support nested transactions in a slightly related tangent.)

I also learned that some JPA providers can take advantage of a double listing: your run-of-the-mill JTA environment (such as an EJB server) will use the <jta-data-source> by default, but the other one might be used by your JPA provider. The JPA specification doesn’t really say anything about this; section is about as close as it gets:  jta-data-source, non-jta-data-source
In Java EE environments, the jta-data-source and non-jta-data-source elements are used to specify the global JNDI name of the JTA and/or non-JTA data source to be used by the persistence provider. If neither is specified, the deployer must specify a JTA data source at deployment or a JTA data source must be provided by the container, and a JTA EntityManagerFactory will be created to correspond to it.

These elements name the data source in the local environment; the format of these names and the ability to specify the names are product specific.

In Java SE environments, these elements may be used or the data source information may be specified by other means—depending upon the requirements of the provider.

Specifically, EclipseLink can use your <non-jta-data-source> element if you instruct it—for example—to use a separate connection for @TableGenerator-based identity generation. Otherwise, your sequence table operations will be only as granular as the (potentially long, hairy) transactions that wrap them.

Obviously, your <jta-data-source> and <non-jta-data-source> had better be pointing at the same data source in this case.

File this under “Huh”.

Tools of the Trade

I thought a quick list of some of my tools might help others as well.

For general document management, Google Drive is the way to go.

When I’m early-stage brainstorming, trying to get my head around a problem, I find that I’m usually totally scatterbrained.  I’ll see small issues and hound off trying to address them before pulling back to the big picture again and forgetting what I just fixed.  I find that mind-mapping software helps immeasurably here, and the tool that is the best that I’ve found is MindMeister (horrifically awful name).  It integrates with Google Drive, so all my mind maps show up in my Drive folder on my machine and are available on the web as well.  They also have a mobile application so I can throw things into a mind map from my iPhone.

For UML modeling, which I use extensively—thus planting me in a solid minority, I know—I use UMLet.  It is quick, dirty, ugly, fast, simple, and gets diagrams on and off the clipboard faster than any other tool and so ends up being a great collaboration tool even in email.

For editing, I’m an emacs user.  Either you get it or you don’t.

For time tracking, I use Harvest and love it.  I used Freckle for a while but it got almost narcissistically focused on how awesome it thought it was and the tone finally drove me away.

For to-do lists I used to be a TeuxDeux disciple.  I still like them.  But their mobile offering stank for a long time, so I switched to Wunderlist.

I use GitHub for tinkering and open source work, but I use Beanstalk for anything more substantial.

Lighthouse is an excellent issue tracker and I have it and Beanstalk integrated.

I got on when it was still, and so still use them for bookmarks.

I’m sure there’s more, but that’s a good start.