Configuration Management in Java EE Applications Using Subversion
Subject:   Requires Two-Phase Commit
Date:   2008-07-29 16:35:51
From:   Andrew Swan
This is an interesting idea.

However I notice that when updating a tracked domain object like your Loan class, two physical updates take place:

  • The new state of the object is saved to the SQL database via JDBC (possibly using an ORM tool like Hibernate)

  • The previous state of the object is saved to SVN via JavaSVN in the manner you describe

In order to maintain the integrity of these two data sources, you need to ensure that both of the above changes either commit or roll back as a single transaction. The traditional way to do this in a J2EE environment is using a two-phase commit (2PC), also known as an XA transaction.

Many JDBC drivers support this type of transaction, some claim to but do not, and some do not even claim to. But let's assume we're using a JDBC driver that does. The other piece of the puzzle is SVN; do you think your SVN-based solution could be modified to implement a 2PC?