Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate In directory sc8-pr-cvs1:/tmp/cvs-serv23158/src/net/sf/hibernate Modified Files: AssertionFailure.java CallbackException.java Databinder.java Environment.java FlushMode.java Hibernate.java HibernateException.java InstantiationException.java Interceptor.java LazyInitializationException.java Lifecycle.java LockMode.java MappingException.java ObjectDeletedException.java ObjectNotFoundException.java PersistentEnum.java PersistentObjectException.java PropertyAccessException.java PropertyNotFoundException.java Query.java QueryException.java ScrollableResults.java Session.java SessionFactory.java StaleObjectStateException.java Transaction.java TransactionException.java TransientObjectException.java UserType.java Validatable.java ValidationFailure.java WrongClassException.java Log Message: added Session.refresh() revised some javadoc new javadoc style consistent with website colors Index: AssertionFailure.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/AssertionFailure.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AssertionFailure.java 4 Jan 2003 11:15:27 -0000 1.2 --- AssertionFailure.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 28,29 **** --- 28,32 ---- + + + Index: CallbackException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/CallbackException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CallbackException.java 4 Jan 2003 11:15:27 -0000 1.2 --- CallbackException.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 26,27 **** --- 26,30 ---- + + + Index: Databinder.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Databinder.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Databinder.java 4 Jan 2003 11:15:27 -0000 1.2 --- Databinder.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 89,90 **** --- 89,93 ---- + + + Index: Environment.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Environment.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Environment.java 4 Jan 2003 11:15:27 -0000 1.2 --- Environment.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 391,392 **** --- 391,395 ---- + + + Index: FlushMode.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/FlushMode.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FlushMode.java 4 Jan 2003 11:15:27 -0000 1.2 --- FlushMode.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 57,58 **** --- 57,61 ---- + + + Index: Hibernate.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Hibernate.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Hibernate.java 4 Jan 2003 11:15:27 -0000 1.2 --- Hibernate.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 235,236 **** --- 235,239 ---- + + + Index: HibernateException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/HibernateException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** HibernateException.java 4 Jan 2003 11:15:27 -0000 1.2 --- HibernateException.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 28,29 **** --- 28,32 ---- + + + Index: InstantiationException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/InstantiationException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** InstantiationException.java 4 Jan 2003 11:15:27 -0000 1.2 --- InstantiationException.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 28,29 **** --- 28,32 ---- + + + Index: Interceptor.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Interceptor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Interceptor.java 4 Jan 2003 11:15:27 -0000 1.2 --- Interceptor.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 66,67 **** --- 66,70 ---- + + + Index: LazyInitializationException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/LazyInitializationException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LazyInitializationException.java 4 Jan 2003 11:15:27 -0000 1.2 --- LazyInitializationException.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 38,39 **** --- 38,42 ---- + + + Index: Lifecycle.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Lifecycle.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Lifecycle.java 4 Jan 2003 11:15:27 -0000 1.2 --- Lifecycle.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 89,90 **** --- 89,93 ---- + + + Index: LockMode.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/LockMode.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LockMode.java 4 Jan 2003 11:15:27 -0000 1.2 --- LockMode.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 85,86 **** --- 85,89 ---- + + + Index: MappingException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/MappingException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MappingException.java 4 Jan 2003 11:15:27 -0000 1.2 --- MappingException.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 25,26 **** --- 25,29 ---- + + + Index: ObjectDeletedException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/ObjectDeletedException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ObjectDeletedException.java 4 Jan 2003 11:15:27 -0000 1.2 --- ObjectDeletedException.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 29,30 **** --- 29,33 ---- + + + Index: ObjectNotFoundException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/ObjectNotFoundException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ObjectNotFoundException.java 4 Jan 2003 11:15:27 -0000 1.2 --- ObjectNotFoundException.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 35,36 **** --- 35,39 ---- + + + Index: PersistentEnum.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/PersistentEnum.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PersistentEnum.java 4 Jan 2003 11:15:27 -0000 1.2 --- PersistentEnum.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 18,19 **** --- 18,22 ---- + + + Index: PersistentObjectException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/PersistentObjectException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PersistentObjectException.java 4 Jan 2003 11:15:27 -0000 1.2 --- PersistentObjectException.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 17,18 **** --- 17,21 ---- + + + Index: PropertyAccessException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/PropertyAccessException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PropertyAccessException.java 4 Jan 2003 11:15:27 -0000 1.2 --- PropertyAccessException.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 39,40 **** --- 39,43 ---- + + + Index: PropertyNotFoundException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/PropertyNotFoundException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PropertyNotFoundException.java 4 Jan 2003 11:15:27 -0000 1.2 --- PropertyNotFoundException.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 24,25 **** --- 24,28 ---- + + + Index: Query.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Query.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Query.java 4 Jan 2003 11:15:27 -0000 1.2 --- Query.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 25,28 **** --- 25,29 ---- * <li>the results may be returned as an instance of <tt>ScrollableResults</tt> * </ul> + * <br> * Use of <tt>setFirstResult()</tt> requires that the JDBC driver implement * scrollable result sets.<br> *************** *** 251,254 **** --- 252,258 ---- public void setEnum(String name, Object val) throws MappingException; // use setParameter for null values } + + + Index: QueryException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/QueryException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** QueryException.java 4 Jan 2003 11:15:27 -0000 1.2 --- QueryException.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 36,37 **** --- 36,40 ---- + + + Index: ScrollableResults.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/ScrollableResults.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ScrollableResults.java 4 Jan 2003 11:15:27 -0000 1.2 --- ScrollableResults.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 165,166 **** --- 165,169 ---- + + + Index: Session.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Session.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Session.java 4 Jan 2003 11:15:27 -0000 1.2 --- Session.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 41,529 **** * <pre> * Session sess = factory.openSession(); * try { ! * //do some work ! * ... ! * sess.flush(); ! * sess.connection().commit(); ! * } ! * catch (Exception e) { ! * sess.connection().rollback(); ! * throw e; ! * } ! * finally { ! * sess.close(); ! * } ! * </pre> ! * Or, when using a datasource enlisted with JTA: ! * <pre> ! * UserTransaction ut = .... ; ! * Session sess = factory.openSession(); ! * try { ! * //do some work ! * ... ! * sess.flush(); ! * } ! * catch (Exception e) { ! * ut.setRollbackOnly(); ! * throw e; ! * } ! * finally { ! * sess.close(); ! * } ! * </pre> ! * <br> ! * If the <tt>Session</tt> throws an exception, the transaction must be rolled back ! * and the session discarded. The internal state of the <tt>Session</tt> might not ! * be consistent with the database after the exception occurs. ! * ! * @see SessionFactory ! */ ! public interface Session extends Serializable { ! ! /** ! * Force the <tt>Session</tt> to flush. Must be called at the end of a ! * unit of work, before commiting the transaction and closing the ! * session (<tt>Transaction.commit()</tt> calls this method). <i>Flushing</i> ! * is the process of synchronising the underlying persistent store with ! * persistable state held in memory. ! * ! * @throws SQLException ! * @throws HibernateException ! */ ! public void flush() throws SQLException, HibernateException; ! ! /** ! * Set the flush mode. The flush mode determines at which points ! * Hibernate automatically flushes the session. For a readonly ! * session, it is reasonable to set the flush mode to ! * <tt>FlushMode.NEVER</tt> at the start of the session (in ! * order to achieve some extra performance). ! * ! * @see FlushMode ! */ ! public void setFlushMode(FlushMode flushMode); ! ! /** ! * Get the current flush mode. ! */ ! public FlushMode getFlushMode(); ! ! /** ! * Get the JDBC connection. Applications are responsible for ! * calling commit/rollback upon the connection before closing ! * the <tt>Session</tt>. ! * ! * @return the JDBC connection in use by the <tt>Session</tt> ! * @throws HibernateException if the <tt>Session</tt> is disconnected ! * @throws SQLException ! */ ! public Connection connection() throws SQLException, HibernateException; ! ! /** ! * Disconnect the <tt>Session</tt> from the current JDBC connection. If ! * the connection was obtained by Hibernate, close it or return it to the ! * connection pool. Otherwise return it to the application.<br> ! * <br> ! * This is used by applications which require long transactions. ! * ! * @return the connection provided by the application or <tt>null</tt> ! * @throws HibernateException if the <tt>Session</tt> is disconnected ! * @throws SQLException ! * @see Session#reconnect() ! */ ! public Connection disconnect() throws SQLException, HibernateException; ! ! /** ! * Obtain a new JDBC connection. This is used by applications which ! * require long transactions. ! * ! * @throws SQLException ! * @see Session#disconnect() ! */ ! public void reconnect() throws SQLException, HibernateException; ! ! /** ! * Reconnect to the given JDBC connection. This is used by applications ! * which require long transactions. ! * ! * @param connection a JDBC connection ! * @throws HibernateException if the <tt>Session</tt> is connected ! * @see Session#disconnect() ! */ ! public void reconnect(Connection connection) throws HibernateException; ! ! /** ! * End the <tt>Session</tt> by disconnecting from the JDBC connection and ! * cleaning up. It is not strictly necessary to <tt>close()</tt> the ! * <tt>Session</tt> but you must at least <tt>disconnect()</tt> it. ! * ! * @return the connection provided by the application ! * or <tt>null</tt> ! * @throws SQLException ! * @throws HibernateException ! */ ! public Connection close() throws SQLException, HibernateException; ! ! /** ! * Is the <tt>Session</tt> still open? ! * ! * @return boolean ! */ ! public boolean isOpen(); ! ! /** ! * Is the <tt>Session</tt> currently connected? ! * ! * @return boolean ! */ ! public boolean isConnected(); ! ! /** ! * Return the identifier of an entity instance cached by the <tt>Session</tt>, or ! * throw an exception if the instance is transient or associated with a different ! * <tt>Session</tt>. ! * ! * @param object a persistent instance ! * @return the identifier ! * @throws HibernateException if the <tt>Session</tt> is connected ! */ ! public Serializable getIdentifier(Object object) throws HibernateException; ! ! /** ! * Return the persistent instance of the given entity class with the given identifier, ! * obtaining the specified lock mode. ! * ! * @param theClass a persistent class ! * @param id a valid identifier of an existing persistent instance of the class ! * @param lockMode the lock level ! * @return the persistent instance ! * @throws SQLException ! * @throws HibernateException ! */ ! public Object load(Class theClass, Serializable id, LockMode lockMode) throws SQLException, HibernateException; ! ! /** ! * Return the persistent instance of the given entity class with the given identifier. ! * ! * @param theClass a persistent class ! * @param id a valid identifier of an existing persistent instance of the class ! * @return the persistent instance ! * @throws SQLException ! * @throws HibernateException ! */ ! public Object load(Class theClass, Serializable id) throws SQLException, HibernateException; ! ! /** ! * Read the persistent state associated with the given identifier into the given transient instance. ! * ! * @param object an "empty" instance of the persistent class ! * @param id a valid identifier of an existing persistent instance of the class ! * @throws SQLException ! * @throws HibernateException ! */ ! public void load(Object object, Serializable id) throws SQLException, HibernateException; ! ! /** ! * Persist the given transient instance, first assigning a generated identifier. (Or ! * using the current value of the identifier property if the <tt>assigned</tt> ! * generator is used.) ! * ! * @param object a transient instance of a persistent class ! * @return the generated identifier ! * @throws SQLException ! * @throws HibernateException ! */ ! public Serializable save(Object object) throws SQLException, HibernateException; ! ! /** ! * Persist the given transient instance, using the given identifier. ! * ! * @param object a transient instance of a persistent class ! * @param id an unused valid identifier ! * @throws SQLException ! * @throws HibernateException ! */ ! public void save(Object object, Serializable id) throws SQLException, HibernateException; ! ! /** ! * Either <tt>save()</tt> or <tt>update()</tt> the given instance, depending upon the value of ! * its identifier property. By default the instance is always saved. This behaviour may be ! * adjusted by specifying an <tt>unsaved-value</tt> attribute of the identifier property ! * mapping. ! * ! * @see Session#save(java.lang.Object) ! * @see Session#update(Object object, Serializable id) ! * @param object a transient instance containing new or updated state ! * @throws SQLException ! * @throws HibernateException ! */ ! public void saveOrUpdate(Object object) throws SQLException, HibernateException; ! ! /** ! * Update the persistent instance with the identifier of the given transient ! * instance. If there is a persistent instance with the same identifier, ! * an exception is thrown.<br> ! * <br> ! * If the given transient instance has a <tt>null</tt> identifier, an exception ! * will be thrown.<br> ! * <br> ! * <em>The class may not contain toplevel collections or collections ! * with subcollections.</em> ! * ! * @param object a transient instance containing updated state ! * @throws SQLException ! * @throws HibernateException ! */ ! public void update(Object object) throws SQLException, HibernateException; ! ! /** ! * Update the persistent state associated with the given identifier. An exception ! * is thrown if there is a persistent instance with the same identifier in the ! * current session.<br> ! * <br> ! * <em>The class may not contain toplevel collections or collections ! * with subcollections.</em> ! * ! * @param object a transient instance containing updated state ! * @param id identifier of persistent instance ! * @throws SQLException ! * @throws HibernateException ! */ ! public void update(Object object, Serializable id) throws SQLException, HibernateException; ! ! /** ! * Remove a persistent instance from the datastore. The argument may be ! * an instance associated with the receiving <tt>Session</tt> or a transient ! * instance with an identifier associated with existing persistent state. ! * ! * @param object the instance to be removed ! * @throws SQLException ! * @throws HibernateException ! */ ! public void delete(Object object) throws SQLException, HibernateException; ! ! /** ! * Execute a query. ! * ! * @param query a query expressed in Hibernate's query language ! * @return a distinct list of instances (or arrays of instances) ! * @throws SQLException ! * @throws HibernateException ! */ ! public List find(String query) throws SQLException, HibernateException; ! ! /** ! * Execute a query, binding a value to a "?" parameter in the query string. ! * ! * @param query the query string ! * @param value a value to be bound to a "?" placeholder (JDBC IN parameter). ! * @param type the Hibernate type of the value ! * @see Hibernate for access to <tt>Type</tt> instances ! * @return a distinct list of instances (or arrays of instances) ! * @throws SQLException ! * @throws HibernateException ! */ ! public List find(String query, Object value, Type type) throws SQLException, HibernateException; ! ! /** ! * Execute a query, binding an array of values to "?" parameters in the query string. ! * ! * @param query the query string ! * @param values an array of values to be bound to the "?" placeholders (JDBC IN parameters). ! * @param types an array of Hibernate types of the values ! * @see Hibernate for access to <tt>Type</tt> instances ! * @return a distinct list of instances ! * @throws SQLException ! * @throws HibernateException ! */ ! public List find(String query, Object[] values, Type[] types) throws SQLException, HibernateException; ! ! /** ! * Execute a query and return the results in an iterator. If the query has multiple ! * return values, values will be returned in an array of type <tt>Object[].</tt><br> ! * <br> ! * Entities returned as results are initialized on demand. The first SQL query returns ! * identifiers only. So <tt>iterate()</tt> is usually a less efficient way to retrieve ! * objects than <tt>find()</tt>. ! * ! * @param query the query string ! * @return an iterator ! * @throws SQLException ! * @throws HibernateException ! */ ! public Iterator iterate(String query) throws SQLException, HibernateException; ! ! /** ! * Execute a query and return the results in an iterator. Write the given value to "?" ! * in the query string. If the query has multiple return values, values will be returned ! * in an array of type <tt>Object[]</tt>.<br> ! * <br> ! * Entities returned as results are initialized on demand. The first SQL query returns ! * identifiers only. So <tt>iterate()</tt> is usually a less efficient way to retrieve ! * objects than <tt>find()</tt>. ! * ! * @param query the query string ! * @param value a value to be witten to a "?" placeholder in the query string ! * @param type the hibernate type of value ! * @return an iterator ! * @throws SQLException ! * @throws HibernateException ! */ ! public Iterator iterate(String query, Object value, Type type) throws SQLException, HibernateException; ! ! /** ! * Execute a query and return the results in an iterator. Write the given values to "?" ! * in the query string. If the query has multiple return values, values will be returned ! * in an array of type <tt>Object[]</tt>.<br> ! * <br> ! * Entities returned as results are initialized on demand. The first SQL query returns ! * identifiers only. So <tt>iterate()</tt> is usually a less efficient way to retrieve ! * objects than <tt>find()</tt>. ! * ! * @param query the query string ! * @param values a list of values to be written to "?" placeholders in the query ! * @param types a list of Hibernate types of the values ! * @return an iterator ! * @throws SQLException ! * @throws HibernateException ! */ ! public Iterator iterate(String query, Object[] values, Type[] types) throws SQLException, HibernateException; ! ! /** ! * Apply a filter to a persistent collection. A filter is a Hibernate query that may refer to ! * <tt>this</tt>, the collection element. Filters allow efficient access to very large lazy ! * collections. (Executing the filter does not initialize the collection.) ! * ! * @param collection a persistent collection to filter ! * @param filter a filter query string ! * @return Collection the resulting collection ! * @throws SQLException ! * @throws HibernateException ! */ ! public Collection filter(Object collection, String filter) throws SQLException, HibernateException; ! ! /** ! * Apply a filter to a persistent collection. A filter is a Hibernate query that may refer to ! * <tt>this</tt>, the collection element. ! * ! * @param collection a persistent collection to filter ! * @param filter a filter query string ! * @param value a value to be witten to a "?" placeholder in the query string ! * @param type the hibernate type of value ! * @return Collection ! * @throws SQLException ! * @throws HibernateException ! */ ! public Collection filter(Object collection, String filter, Object value, Type type) throws SQLException, HibernateException; ! ! /** ! * Apply a filter to a persistent collection, binding the given parameters to "?" placeholders. ! * A filter is a Hibernate query that may refer to <tt>this</tt>, the collection element. ! * ! * @param collection a persistent collection to filter ! * @param filter a filter query string ! * @param values a list of values to be written to "?" placeholders in the query ! * @param types a list of Hibernate types of the values ! * @return Collection ! * @throws SQLException ! * @throws HibernateException ! */ ! public Collection filter(Object collection, String filter, Object[] values, Type[] types) throws SQLException, HibernateException; ! ! /** ! * Delete all objects returned by the query. Return the number of objects deleted. ! * ! * @param query the query string ! * @return the number of instances deleted ! * @throws SQLException ! * @throws HibernateException ! */ ! public int delete(String query) throws SQLException, HibernateException; ! ! /** ! * Delete all objects returned by the query. Return the number of objects deleted. ! * ! * @param query the query string ! * @param value a value to be witten to a "?" placeholder in the query string. ! * @param type the hibernate type of value. ! * @return the number of instances deleted ! * @throws SQLException ! * @throws HibernateException ! */ ! public int delete(String query, Object value, Type type) throws SQLException, HibernateException; ! ! /** ! * Delete all objects returned by the query. Return the number of objects deleted. ! * ! * @param query the query string ! * @param values a list of values to be written to "?" placeholders in the query. ! * @param types a list of Hibernate types of the values ! * @return the number of instances deleted ! * @throws SQLException ! * @throws HibernateException ! */ ! public int delete(String query, Object[] values, Type[] types) throws SQLException, HibernateException; ! ! /** ! * Obtain the specified lock level upon the given object. ! * ! * @param object a persistent instance ! * @param lockMode the lock level ! * @throws SQLException ! * @throws HibernateException ! */ ! public void lock(Object object, LockMode lockMode) throws SQLException, HibernateException; ! ! /** ! * Determine the current lock mode of the given object ! * ! * @param object a persistent instance ! * @return the current lock mode ! */ ! public LockMode getCurrentLockMode(Object object) throws HibernateException; ! ! /** ! * Begin a unit of work and return the associated <tt>Transaction</tt> object. ! * If a new underlying transaction is required, begin the transaction. ! * The class of the returned <tt>Transaction</tt> object is determined by the ! * property <tt>hibernate.transaction_factory</tt>. ! * ! * @return a Transaction instance ! * @throws HibernateException ! * @see Transaction ! */ ! public Transaction beginTransaction() throws HibernateException; ! ! /** ! * Create a new instance of <tt>Query</tt> for the given query string. ! * ! * @param queryString a Hibernate query ! * @return Query ! * @throws HibernateException ! */ ! public Query createQuery(String queryString) throws HibernateException; ! ! /** ! * Create a new instance of <tt>Query</tt> for the given collection and filter string. ! * ! * @param collection a persistent collection ! * @param queryString a Hibernate query ! * @return Query ! * @throws HibernateException ! */ ! public Query createFilter(Object collection, String queryString) throws HibernateException; ! ! /** ! * Obtain an instance of <tt>Query</tt> for a named query string defined in the ! * mapping file. ! * ! * @param queryString the name of a query defined externally ! * @return Query ! * @throws HibernateException ! */ ! public Query getNamedQuery(String queryName) throws HibernateException; ! ! } ! ! ! --- 41,534 ---- * <pre> * Session sess = factory.openSession(); + * Transaction tx; * try { ! * tx = sess.beginTransaction(); ! * //do some work ! * ... ! * tx.commit(); ! * } ! * catch (Exception e) { ! * if (tx!=null) tx.rollback(); ! * throw e; ! * } ! * finally { ! * sess.close(); ! * } ! * </pre> ! * <br> ! * If the <tt>Session</tt> throws an exception, the transaction must be rolled back ! * and the session discarded. The internal state of the <tt>Session</tt> might not ! * be consistent with the database after the exception occurs. ! * ! * @see SessionFactory ! */ ! public interface Session extends Serializable { ! ! /** ! * Force the <tt>Session</tt> to flush. Must be called at the end of a ! * unit of work, before commiting the transaction and closing the ! * session (<tt>Transaction.commit()</tt> calls this method). <i>Flushing</i> ! * is the process of synchronising the underlying persistent store with ! * persistable state held in memory. ! * ! * @throws SQLException ! * @throws HibernateException ! */ ! public void flush() throws SQLException, HibernateException; ! ! /** ! * Set the flush mode. The flush mode determines at which points ! * Hibernate automatically flushes the session. For a readonly ! * session, it is reasonable to set the flush mode to ! * <tt>FlushMode.NEVER</tt> at the start of the session (in ! * order to achieve some extra performance). ! * ! * @see FlushMode ! */ ! public void setFlushMode(FlushMode flushMode); ! ! /** ! * Get the current flush mode. ! */ ! public FlushMode getFlushMode(); ! ! /** ! * Get the JDBC connection. Applications are responsible for ! * calling commit/rollback upon the connection before closing ! * the <tt>Session</tt>. ! * ! * @return the JDBC connection in use by the <tt>Session</tt> ! * @throws HibernateException if the <tt>Session</tt> is disconnected ! * @throws SQLException ! */ ! public Connection connection() throws SQLException, HibernateException; ! ! /** ! * Disconnect the <tt>Session</tt> from the current JDBC connection. If ! * the connection was obtained by Hibernate, close it or return it to the ! * connection pool. Otherwise return it to the application.<br> ! * <br> ! * This is used by applications which require long transactions. ! * ! * @return the connection provided by the application or <tt>null</tt> ! * @throws HibernateException if the <tt>Session</tt> is disconnected ! * @throws SQLException ! * @see Session#reconnect() ! */ ! public Connection disconnect() throws SQLException, HibernateException; ! ! /** ! * Obtain a new JDBC connection. This is used by applications which ! * require long transactions. ! * ! * @throws SQLException ! * @see Session#disconnect() ! */ ! public void reconnect() throws SQLException, HibernateException; ! ! /** ! * Reconnect to the given JDBC connection. This is used by applications ! * which require long transactions. ! * ! * @param connection a JDBC connection ! * @throws HibernateException if the <tt>Session</tt> is connected ! * @see Session#disconnect() ! */ ! public void reconnect(Connection connection) throws HibernateException; ! ! /** ! * End the <tt>Session</tt> by disconnecting from the JDBC connection and ! * cleaning up. It is not strictly necessary to <tt>close()</tt> the ! * <tt>Session</tt> but you must at least <tt>disconnect()</tt> it. ! * ! * @return the connection provided by the application ! * or <tt>null</tt> ! * @throws SQLException ! * @throws HibernateException ! */ ! public Connection close() throws SQLException, HibernateException; ! ! /** ! * Is the <tt>Session</tt> still open? ! * ! * @return boolean ! */ ! public boolean isOpen(); ! ! /** ! * Is the <tt>Session</tt> currently connected? ! * ! * @return boolean ! */ ! public boolean isConnected(); ! ! /** ! * Return the identifier of an entity instance cached by the <tt>Session</tt>, or ! * throw an exception if the instance is transient or associated with a different ! * <tt>Session</tt>. ! * ! * @param object a persistent instance ! * @return the identifier ! * @throws HibernateException if the <tt>Session</tt> is connected ! */ ! public Serializable getIdentifier(Object object) throws HibernateException; ! ! /** ! * Return the persistent instance of the given entity class with the given identifier, ! * obtaining the specified lock mode. ! * ! * @param theClass a persistent class ! * @param id a valid identifier of an existing persistent instance of the class ! * @param lockMode the lock level ! * @return the persistent instance ! * @throws SQLException ! * @throws HibernateException ! */ ! public Object load(Class theClass, Serializable id, LockMode lockMode) throws SQLException, HibernateException; ! ! /** ! * Return the persistent instance of the given entity class with the given identifier. ! * ! * @param theClass a persistent class ! * @param id a valid identifier of an existing persistent instance of the class ! * @return the persistent instance ! * @throws SQLException ! * @throws HibernateException ! */ ! public Object load(Class theClass, Serializable id) throws SQLException, HibernateException; ! ! /** ! * Read the persistent state associated with the given identifier into the given transient instance. ! * ! * @param object an "empty" instance of the persistent class ! * @param id a valid identifier of an existing persistent instance of the class ! * @throws SQLException ! * @throws HibernateException ! */ ! public void load(Object object, Serializable id) throws SQLException, HibernateException; ! ! /** ! * Persist the given transient instance, first assigning a generated identifier. (Or ! * using the current value of the identifier property if the <tt>assigned</tt> ! * generator is used.) ! * ! * @param object a transient instance of a persistent class ! * @return the generated identifier ! * @throws SQLException ! * @throws HibernateException ! */ ! public Serializable save(Object object) throws SQLException, HibernateException; ! ! /** ! * Persist the given transient instance, using the given identifier. ! * ! * @param object a transient instance of a persistent class ! * @param id an unused valid identifier ! * @throws SQLException ! * @throws HibernateException ! */ ! public void save(Object object, Serializable id) throws SQLException, HibernateException; ! ! /** ! * Either <tt>save()</tt> or <tt>update()</tt> the given instance, depending upon the value of ! * its identifier property. By default the instance is always saved. This behaviour may be ! * adjusted by specifying an <tt>unsaved-value</tt> attribute of the identifier property ! * mapping. ! * ! * @see Session#save(java.lang.Object) ! * @see Session#update(Object object, Serializable id) ! * @param object a transient instance containing new or updated state ! * @throws SQLException ! * @throws HibernateException ! */ ! public void saveOrUpdate(Object object) throws SQLException, HibernateException; ! ! /** ! * Update the persistent instance with the identifier of the given transient ! * instance. If there is a persistent instance with the same identifier, ! * an exception is thrown.<br> ! * <br> ! * If the given transient instance has a <tt>null</tt> identifier, an exception ! * will be thrown.<br> ! * <br> ! * <em>The class may not contain toplevel collections or collections ! * with subcollections.</em> ! * ! * @param object a transient instance containing updated state ! * @throws SQLException ! * @throws HibernateException ! */ ! public void update(Object object) throws SQLException, HibernateException; ! ! /** ! * Update the persistent state associated with the given identifier. An exception ! * is thrown if there is a persistent instance with the same identifier in the ! * current session.<br> ! * <br> ! * <em>The class may not contain toplevel collections or collections ! * with subcollections.</em> ! * ! * @param object a transient instance containing updated state ! * @param id identifier of persistent instance ! * @throws SQLException ! * @throws HibernateException ! */ ! public void update(Object object, Serializable id) throws SQLException, HibernateException; ! ! /** ! * Remove a persistent instance from the datastore. The argument may be ! * an instance associated with the receiving <tt>Session</tt> or a transient ! * instance with an identifier associated with existing persistent state. ! * ! * @param object the instance to be removed ! * @throws SQLException ! * @throws HibernateException ! */ ! public void delete(Object object) throws SQLException, HibernateException; ! ! /** ! * Execute a query. ! * ! * @param query a query expressed in Hibernate's query language ! * @return a distinct list of instances (or arrays of instances) ! * @throws SQLException ! * @throws HibernateException ! */ ! public List find(String query) throws SQLException, HibernateException; ! ! /** ! * Execute a query, binding a value to a "?" parameter in the query string. ! * ! * @param query the query string ! * @param value a value to be bound to a "?" placeholder (JDBC IN parameter). ! * @param type the Hibernate type of the value ! * @see Hibernate for access to <tt>Type</tt> instances ! * @return a distinct list of instances (or arrays of instances) ! * @throws SQLException ! * @throws HibernateException ! */ ! public List find(String query, Object value, Type type) throws SQLException, HibernateException; ! ! /** ! * Execute a query, binding an array of values to "?" parameters in the query string. ! * ! * @param query the query string ! * @param values an array of values to be bound to the "?" placeholders (JDBC IN parameters). ! * @param types an array of Hibernate types of the values ! * @see Hibernate for access to <tt>Type</tt> instances ! * @return a distinct list of instances ! * @throws SQLException ! * @throws HibernateException ! */ ! public List find(String query, Object[] values, Type[] types) throws SQLException, HibernateException; ! ! /** ! * Execute a query and return the results in an iterator. If the query has multiple ! * return values, values will be returned in an array of type <tt>Object[].</tt><br> ! * <br> ! * Entities returned as results are initialized on demand. The first SQL query returns ! * identifiers only. So <tt>iterate()</tt> is usually a less efficient way to retrieve ! * objects than <tt>find()</tt>. ! * ! * @param query the query string ! * @return an iterator ! * @throws SQLException ! * @throws HibernateException ! */ ! public Iterator iterate(String query) throws SQLException, HibernateException; ! ! /** ! * Execute a query and return the results in an iterator. Write the given value to "?" ! * in the query string. If the query has multiple return values, values will be returned ! * in an array of type <tt>Object[]</tt>.<br> ! * <br> ! * Entities returned as results are initialized on demand. The first SQL query returns ! * identifiers only. So <tt>iterate()</tt> is usually a less efficient way to retrieve ! * objects than <tt>find()</tt>. ! * ! * @param query the query string ! * @param value a value to be witten to a "?" placeholder in the query string ! * @param type the hibernate type of value ! * @return an iterator ! * @throws SQLException ! * @throws HibernateException ! */ ! public Iterator iterate(String query, Object value, Type type) throws SQLException, HibernateException; ! ! /** ! * Execute a query and return the results in an iterator. Write the given values to "?" ! * in the query string. If the query has multiple return values, values will be returned ! * in an array of type <tt>Object[]</tt>.<br> ! * <br> ! * Entities returned as results are initialized on demand. The first SQL query returns ! * identifiers only. So <tt>iterate()</tt> is usually a less efficient way to retrieve ! * objects than <tt>find()</tt>. ! * ! * @param query the query string ! * @param values a list of values to be written to "?" placeholders in the query ! * @param types a list of Hibernate types of the values ! * @return an iterator ! * @throws SQLException ! * @throws HibernateException ! */ ! public Iterator iterate(String query, Object[] values, Type[] types) throws SQLException, HibernateException; ! ! /** ! * Apply a filter to a persistent collection. A filter is a Hibernate query that may refer to ! * <tt>this</tt>, the collection element. Filters allow efficient access to very large lazy ! * collections. (Executing the filter does not initialize the collection.) ! * ! * @param collection a persistent collection to filter ! * @param filter a filter query string ! * @return Collection the resulting collection ! * @throws SQLException ! * @throws HibernateException ! */ ! public Collection filter(Object collection, String filter) throws SQLException, HibernateException; ! ! /** ! * Apply a filter to a persistent collection. A filter is a Hibernate query that may refer to ! * <tt>this</tt>, the collection element. ! * ! * @param collection a persistent collection to filter ! * @param filter a filter query string ! * @param value a value to be witten to a "?" placeholder in the query string ! * @param type the hibernate type of value ! * @return Collection ! * @throws SQLException ! * @throws HibernateException ! */ ! public Collection filter(Object collection, String filter, Object value, Type type) throws SQLException, HibernateException; ! ! /** ! * Apply a filter to a persistent collection, binding the given parameters to "?" placeholders. ! * A filter is a Hibernate query that may refer to <tt>this</tt>, the collection element. ! * ! * @param collection a persistent collection to filter ! * @param filter a filter query string ! * @param values a list of values to be written to "?" placeholders in the query ! * @param types a list of Hibernate types of the values ! * @return Collection ! * @throws SQLException ! * @throws HibernateException ! */ ! public Collection filter(Object collection, String filter, Object[] values, Type[] types) throws SQLException, HibernateException; ! ! /** ! * Delete all objects returned by the query. Return the number of objects deleted. ! * ! * @param query the query string ! * @return the number of instances deleted ! * @throws SQLException ! * @throws HibernateException ! */ ! public int delete(String query) throws SQLException, HibernateException; ! ! /** ! * Delete all objects returned by the query. Return the number of objects deleted. ! * ! * @param query the query string ! * @param value a value to be witten to a "?" placeholder in the query string. ! * @param type the hibernate type of value. ! * @return the number of instances deleted ! * @throws SQLException ! * @throws HibernateException ! */ ! public int delete(String query, Object value, Type type) throws SQLException, HibernateException; ! ! /** ! * Delete all objects returned by the query. Return the number of objects deleted. ! * ! * @param query the query string ! * @param values a list of values to be written to "?" placeholders in the query. ! * @param types a list of Hibernate types of the values ! * @return the number of instances deleted ! * @throws SQLException ! * @throws HibernateException ! */ ! public int delete(String query, Object[] values, Type[] types) throws SQLException, HibernateException; ! ! /** ! * Obtain the specified lock level upon the given object. ! * ! * @param object a persistent instance ! * @param lockMode the lock level ! * @throws SQLException ! * @throws HibernateException ! */ ! public void lock(Object object, LockMode lockMode) throws SQLException, HibernateException; ! ! /** ! * Re-read the state of the given instance from the underlying database. It is ! * inadvisable to use this to implement long-running sessions that span many ! * business tasks. This method is, however, useful in certain special circumstances. ! * For example ! * <ul> ! * <li>where a database trigger alters the object state upon insert or update ! * <li>after executing direct SQL (eg. a mass update) in the same session ! * <li>after inserting a <tt>Blob</tt> or <tt>Clob</tt> ! * </ul> ! * ! * @param object a persistent instance ! * @throws HibernateException ! * @throws SQLException ! */ ! public void refresh(Object object) throws SQLException, HibernateException; ! ! /** ! * Determine the current lock mode of the given object ! * ! * @param object a persistent instance ! * @return the current lock mode ! * @throws HibernateException ! */ ! public LockMode getCurrentLockMode(Object object) throws HibernateException; ! ! /** ! * Begin a unit of work and return the associated <tt>Transaction</tt> object. ! * If a new underlying transaction is required, begin the transaction. ! * The class of the returned <tt>Transaction</tt> object is determined by the ! * property <tt>hibernate.transaction_factory</tt>. ! * ! * @return a Transaction instance ! * @throws HibernateException ! * @see Transaction ! */ ! public Transaction beginTransaction() throws HibernateException; ! ! /** ! * Create a new instance of <tt>Query</tt> for the given query string. ! * ! * @param queryString a Hibernate query ! * @return Query ! * @throws HibernateException ! */ ! public Query createQuery(String queryString) throws HibernateException; ! ! /** ! * Create a new instance of <tt>Query</tt> for the given collection and filter string. ! * ! * @param collection a persistent collection ! * @param queryString a Hibernate query ! * @return Query ! * @throws HibernateException ! */ ! public Query createFilter(Object collection, String queryString) throws HibernateException; ! ! /** ! * Obtain an instance of <tt>Query</tt> for a named query string defined in the ! * mapping file. ! * ! * @param queryString the name of a query defined externally ! * @return Query ! * @throws HibernateException ! */ ! public Query getNamedQuery(String queryName) throws HibernateException; ! ! } ! ! ! ! ! ! Index: SessionFactory.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/SessionFactory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SessionFactory.java 4 Jan 2003 11:15:27 -0000 1.2 --- SessionFactory.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 198,199 **** --- 198,202 ---- + + + Index: StaleObjectStateException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/StaleObjectStateException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StaleObjectStateException.java 4 Jan 2003 11:15:27 -0000 1.2 --- StaleObjectStateException.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 40,41 **** --- 40,44 ---- + + + Index: Transaction.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Transaction.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Transaction.java 4 Jan 2003 11:15:27 -0000 1.2 --- Transaction.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 64,65 **** --- 64,68 ---- + + + Index: TransactionException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/TransactionException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TransactionException.java 4 Jan 2003 11:15:27 -0000 1.2 --- TransactionException.java 5 Jan 2003 02:11:19 -0000 1.3 *************** *** 18,19 **** --- 18,22 ---- + + + Index: TransientObjectException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/TransientObjectException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TransientObjectException.java 4 Jan 2003 11:15:27 -0000 1.2 --- TransientObjectException.java 5 Jan 2003 02:11:20 -0000 1.3 *************** *** 17,18 **** --- 17,21 ---- + + + Index: UserType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/UserType.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** UserType.java 4 Jan 2003 11:15:27 -0000 1.2 --- UserType.java 5 Jan 2003 02:11:20 -0000 1.3 *************** *** 14,17 **** --- 14,18 ---- * <li>hides certain "internal" interfaces from user code.</li> * </ul> + * <br> * Implementors must be immutable and must declare a public * default constructor.<br> *************** *** 98,101 **** --- 99,105 ---- public boolean isMutable(); } + + + Index: Validatable.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Validatable.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Validatable.java 4 Jan 2003 11:15:27 -0000 1.2 --- Validatable.java 5 Jan 2003 02:11:20 -0000 1.3 *************** *** 19,20 **** --- 19,23 ---- + + + Index: ValidationFailure.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/ValidationFailure.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ValidationFailure.java 4 Jan 2003 11:15:27 -0000 1.2 --- ValidationFailure.java 5 Jan 2003 02:11:20 -0000 1.3 *************** *** 25,26 **** --- 25,29 ---- + + + Index: WrongClassException.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/WrongClassException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WrongClassException.java 4 Jan 2003 11:15:27 -0000 1.2 --- WrongClassException.java 5 Jan 2003 02:11:20 -0000 1.3 *************** *** 37,38 **** --- 37,41 ---- + + + |