From: Anton v. S. <an...@ap...> - 2002-05-27 03:49:01
|
I've checked in an initial, quite minimal version of the transaction changes. This message is mainly for Gavin's benefit, but if anyone else wants to follow along or comment, the gory details follow. There are only two small changes to existing code, both in the cirrus.hibernate package. Existing client code should be unaffected by this, so the change is completely optional for users. The changes are summarized below, for convenience. I've included the actual source code (minus comments), except for the two new classes, since it's so short and summarizes the changes well. I'll send a separate message with some design issues that I have questions about. In Hibernate.java, the following two methods were added: public static TransactionFactory buildTransactionFactory() throws HibernateException { return new TransactionFactoryImpl(); } public static TransactionFactory buildTransactionFactory(Properties transactionProps) throws HibernateException { return new TransactionFactoryImpl(transactionProps); } In Environment.java, the following definition was added: public static final String TRANSACTION_STRATEGY = "hibernate.transaction_strategy"; In addition to the above, there are two new public interfaces in cirrus.hibernate: public interface Transaction { public void commit() throws HibernateException; public void rollback() throws HibernateException; } public interface TransactionFactory { public Transaction beginTransaction(Session session) throws HibernateException; } Then there's a new package, cirrus.hibernate.transaction. This contains one "internal" interface: interface TransactionImplementor extends Transaction { public void begin(Session session) throws HibernateException; } cirrus.hibernate.transaction also contains two new classes, so far: class TransactionFactoryImpl implements TransactionFactory; class JDBCTransaction implements TransactionImplementor; That's it. I also added a line to the changelog under 0.9.14. I haven't yet implemented JTATransaction or CMTTransaction, although obviously they ought to be pretty simple (if not completely empty). I've performed only limited tests so far, to make sure my own application could use the new functionality, and that existing code didn't break. Of course, the changes are such that existing code is unlikely to be affected. Let me know if I've forgotten anything. Feel free to change anything at all, or if you'd like me to make particular changes. I'm going to be doing some work integrating into my own application, and will enhance the transaction code as necessary, as I go along. Anton |