From: <one...@us...> - 2002-11-05 16:58:18
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/odmg In directory usw-pr-cvs1:/tmp/cvs-serv12927/cirrus/hibernate/odmg Modified Files: Implementation.java Transaction.java Log Message: removed deprecated methods in preparation for version 1.2 Index: Implementation.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/odmg/Implementation.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Implementation.java 26 Oct 2002 09:39:47 -0000 1.7 --- Implementation.java 5 Nov 2002 16:58:14 -0000 1.8 *************** *** 126,130 **** public String getObjectId(Object obj) { try { ! return database.getSession().getID(obj).toString(); } catch (HibernateException he) { --- 126,130 ---- public String getObjectId(Object obj) { try { ! return database.getSession().getIdentifier(obj).toString(); } catch (HibernateException he) { Index: Transaction.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/odmg/Transaction.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Transaction.java 12 Sep 2002 18:19:15 -0000 1.5 --- Transaction.java 5 Nov 2002 16:58:14 -0000 1.6 *************** *** 2,6 **** import java.sql.SQLException; import org.odmg.LockNotGrantedException; import org.odmg.ODMGException; import org.odmg.ODMGRuntimeException; ! import cirrus.hibernate.HibernateException; import cirrus.hibernate.Session; /** * Implements the ODMG <tt>Transaction</tt> API. */ public class Transaction implements org.odmg.Transaction { private final Database database; private final Session session; private cirrus.hibernate.Transaction tx; --- 2,6 ---- import java.sql.SQLException; import org.odmg.LockNotGrantedException; import org.odmg.ODMGException; import org.odmg.ODMGRuntimeException; ! import cirrus.hibernate.HibernateException; import cirrus.hibernate.LockMode; import cirrus.hibernate.Session; /** * Implements the ODMG <tt>Transaction</tt> API. */ public class Transaction implements org.odmg.Transaction { private final Database database; private final Session session; private cirrus.hibernate.Transaction tx; *************** *** 13,17 **** /** * Commit the transaction. * @see org.odmg.Transaction#commit() */ public void commit() { database.disassociateThread(); try { tx.commit(); } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } catch (SQLException sqle) { throw new ODMGRuntimeException( sqle.getMessage() ); } finally { tx=null; try { session.close(); } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } catch (SQLException sqle) { throw new ODMGRuntimeException( sqle.getMessage() ); } } } /** * Abort the transaction. * @see org.odmg.Transaction#abort() */ public void abort() { database.disassociateThread(); try { tx.rollback(); } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } finally { tx=null; try { session.close(); } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } catch (SQLException sqle) { throw new ODMGRuntimeException( sqle.getMessage() ); } } } ! /** * Commit the changes, but leave the transaction open. This implementation * does not have quite the same semantics os ODMG (locks are not retained). * So you should only use this with versioned data. * @see org.odmg.Transaction#checkpoint() */ public void checkpoint() { try { tx.commit(); tx = session.beginTransaction(); } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } catch (SQLException sqle) { throw new ODMGRuntimeException( sqle.getMessage() ); } } /** * Obtain a lock upon the given object. In the present implementation, * <tt>READ</tt> lock mode is ignored while <tt>UPGRADE</tt> and * <tt>WRITE</tt> lock modes obtain an <tt>UPGRADE</tt> lock for databases * which support <tt>for update</tt>. We should improve this eventually.... * @see org.odmg.Transaction#lock(Object, int) */ public void lock(Object obj, int lockMode) throws LockNotGrantedException { //TODO: check the semantics of this... try { if ( lockMode!=org.odmg.Transaction.READ ) { session.lock(obj); } } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } catch (SQLException sqle) { throw new ODMGRuntimeException( sqle.getMessage() ); } } /** * Not implemented. * @see org.odmg.Transaction#tryLock(Object, int) */ public boolean tryLock(Object obj, int lockMode) { throw new UnsupportedOperationException("try using lock()"); } } --- 13,17 ---- /** * Commit the transaction. * @see org.odmg.Transaction#commit() */ public void commit() { database.disassociateThread(); try { tx.commit(); } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } catch (SQLException sqle) { throw new ODMGRuntimeException( sqle.getMessage() ); } finally { tx=null; try { session.close(); } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } catch (SQLException sqle) { throw new ODMGRuntimeException( sqle.getMessage() ); } } } /** * Abort the transaction. * @see org.odmg.Transaction#abort() */ public void abort() { database.disassociateThread(); try { tx.rollback(); } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } finally { tx=null; try { session.close(); } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } catch (SQLException sqle) { throw new ODMGRuntimeException( sqle.getMessage() ); } } } ! /** * Commit the changes, but leave the transaction open. This implementation * does not have quite the same semantics os ODMG (locks are not retained). * So you should only use this with versioned data. * @see org.odmg.Transaction#checkpoint() */ public void checkpoint() { try { tx.commit(); tx = session.beginTransaction(); } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } catch (SQLException sqle) { throw new ODMGRuntimeException( sqle.getMessage() ); } } /** * Obtain a lock upon the given object. In the present implementation, * <tt>READ</tt> lock mode is ignored while <tt>UPGRADE</tt> and * <tt>WRITE</tt> lock modes obtain an <tt>UPGRADE</tt> lock for databases * which support <tt>for update</tt>. We should improve this eventually.... * @see org.odmg.Transaction#lock(Object, int) */ public void lock(Object obj, int lockMode) throws LockNotGrantedException { //TODO: check the semantics of this... try { if ( lockMode==org.odmg.Transaction.READ ) { session.lock(obj, LockMode.READ); } else { session.lock(obj, LockMode.UPGRADE); } } catch (HibernateException he) { throw new ODMGRuntimeException( he.getMessage() ); } catch (SQLException sqle) { throw new ODMGRuntimeException( sqle.getMessage() ); } } /** * Not implemented. * @see org.odmg.Transaction#tryLock(Object, int) */ public boolean tryLock(Object obj, int lockMode) { throw new UnsupportedOperationException("try using lock()"); } } |