Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl
In directory sc8-pr-cvs1:/tmp/cvs-serv19888/net/sf/hibernate/impl
Modified Files:
DatastoreImpl.java FilterImpl.java QueryImpl.java
ScrollableResultsImpl.java SessionFactoryImpl.java
SessionImpl.java
Log Message:
wrap all SQLExceptions fixed a bug in SchemaExport where generated foreign key constraints did not used qualified tablename for referenced table
Index: DatastoreImpl.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/DatastoreImpl.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** DatastoreImpl.java 9 Jan 2003 12:24:51 -0000 1.4
--- DatastoreImpl.java 14 Jan 2003 13:42:11 -0000 1.5
***************
*** 15,33 ****
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
! import org.w3c.dom.*;
import org.xml.sax.InputSource;
! import net.sf.hibernate.engine.*;
! import net.sf.hibernate.util.*;
! import net.sf.hibernate.mapping.*;
! import net.sf.hibernate.type.*;
! import net.sf.hibernate.*;
import net.sf.hibernate.MappingException;
import net.sf.hibernate.tool.hbm2ddl.JdbcDatabaseInfo;
import net.sf.hibernate.tool.hbm2ddl.JdbcTableInfo;
import net.sf.hibernate.id.IdentifierGenerator;
import net.sf.hibernate.id.PersistentIdentifierGenerator;
! import net.sf.hibernate.cfg.*;
import net.sf.hibernate.dialect.Dialect;
/**
--- 15,42 ----
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
! import org.w3c.dom.Document;
import org.xml.sax.InputSource;
! import net.sf.hibernate.util.ArrayHelper;
! import net.sf.hibernate.util.XMLHelper;
! import net.sf.hibernate.Environment;
! import net.sf.hibernate.HibernateException;
! import net.sf.hibernate.Interceptor;
import net.sf.hibernate.MappingException;
+ import net.sf.hibernate.SessionFactory;
import net.sf.hibernate.tool.hbm2ddl.JdbcDatabaseInfo;
import net.sf.hibernate.tool.hbm2ddl.JdbcTableInfo;
+ import net.sf.hibernate.type.Type;
import net.sf.hibernate.id.IdentifierGenerator;
import net.sf.hibernate.id.PersistentIdentifierGenerator;
! import net.sf.hibernate.mapping.Collection;
! import net.sf.hibernate.mapping.ForeignKey;
! import net.sf.hibernate.mapping.Index;
! import net.sf.hibernate.mapping.PersistentClass;
! import net.sf.hibernate.mapping.Root;
! import net.sf.hibernate.mapping.Table;
! import net.sf.hibernate.cfg.Datastore;
import net.sf.hibernate.dialect.Dialect;
+ import net.sf.hibernate.engine.Mapping;
/**
Index: FilterImpl.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/FilterImpl.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** FilterImpl.java 5 Jan 2003 02:11:21 -0000 1.4
--- FilterImpl.java 14 Jan 2003 13:42:11 -0000 1.5
***************
*** 1,5 ****
package net.sf.hibernate.impl;
- import java.sql.SQLException;
import java.util.Iterator;
import java.util.List;
--- 1,4 ----
***************
*** 26,30 ****
* @see net.sf.hibernate.Query#iterate()
*/
! public Iterator iterate() throws SQLException, HibernateException {
getValues().add(0, null);
getTypes().add(0, null);
--- 25,29 ----
* @see net.sf.hibernate.Query#iterate()
*/
! public Iterator iterate() throws HibernateException {
getValues().add(0, null);
getTypes().add(0, null);
***************
*** 35,39 ****
* @see net.sf.hibernate.Query#list()
*/
! public List list() throws SQLException, HibernateException {
getValues().add(0, null);
getTypes().add(0, null);
--- 34,38 ----
* @see net.sf.hibernate.Query#list()
*/
! public List list() throws HibernateException {
getValues().add(0, null);
getTypes().add(0, null);
***************
*** 44,48 ****
* @see net.sf.hibernate.Query#scroll()
*/
! public ScrollableResults scroll() throws SQLException, HibernateException {
throw new UnsupportedOperationException("Can't scroll filters");
}
--- 43,47 ----
* @see net.sf.hibernate.Query#scroll()
*/
! public ScrollableResults scroll() throws HibernateException {
throw new UnsupportedOperationException("Can't scroll filters");
}
Index: QueryImpl.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/QueryImpl.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** QueryImpl.java 5 Jan 2003 02:11:21 -0000 1.4
--- QueryImpl.java 14 Jan 2003 13:42:12 -0000 1.5
***************
*** 4,8 ****
import java.io.Serializable;
import java.math.BigDecimal;
- import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Calendar;
--- 4,7 ----
***************
*** 48,60 ****
static final Type[] NO_TYPES = new Type[0];
! public Iterator iterate() throws SQLException, HibernateException {
return session.iterate(queryString, values.toArray(), (Type[]) types.toArray(NO_TYPES), selection, namedParams);
}
! public ScrollableResults scroll() throws SQLException, HibernateException {
return session.scroll(queryString, values.toArray(), (Type[]) types.toArray(NO_TYPES), selection, namedParams);
}
! public List list() throws SQLException, HibernateException {
return session.find(queryString, values.toArray(), (Type[]) types.toArray(NO_TYPES), selection, namedParams);
}
--- 47,59 ----
static final Type[] NO_TYPES = new Type[0];
! public Iterator iterate() throws HibernateException {
return session.iterate(queryString, values.toArray(), (Type[]) types.toArray(NO_TYPES), selection, namedParams);
}
! public ScrollableResults scroll() throws HibernateException {
return session.scroll(queryString, values.toArray(), (Type[]) types.toArray(NO_TYPES), selection, namedParams);
}
! public List list() throws HibernateException {
return session.find(queryString, values.toArray(), (Type[]) types.toArray(NO_TYPES), selection, namedParams);
}
Index: ScrollableResultsImpl.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/ScrollableResultsImpl.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ScrollableResultsImpl.java 12 Jan 2003 07:07:49 -0000 1.4
--- ScrollableResultsImpl.java 14 Jan 2003 13:42:12 -0000 1.5
***************
*** 13,18 ****
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.ScrollableResults;
! import net.sf.hibernate.engine.*;
import net.sf.hibernate.hql.QueryTranslator;
import net.sf.hibernate.type.Type;
--- 13,19 ----
import net.sf.hibernate.HibernateException;
+ import net.sf.hibernate.JDBCException;
import net.sf.hibernate.ScrollableResults;
! import net.sf.hibernate.engine.SessionImplementor;
import net.sf.hibernate.hql.QueryTranslator;
import net.sf.hibernate.type.Type;
***************
*** 29,34 ****
* @see net.sf.hibernate.ScrollableResults#advance(int)
*/
! public boolean scroll(int i) throws SQLException, HibernateException {
! return rs.relative(i);
}
--- 30,40 ----
* @see net.sf.hibernate.ScrollableResults#advance(int)
*/
! public boolean scroll(int i) throws HibernateException {
! try {
! return rs.relative(i);
! }
! catch (SQLException sqle) {
! throw new JDBCException(sqle);
! }
}
***************
*** 36,41 ****
* @see net.sf.hibernate.ScrollableResults#first()
*/
! public boolean first() throws SQLException, HibernateException {
! return rs.first();
}
--- 42,52 ----
* @see net.sf.hibernate.ScrollableResults#first()
*/
! public boolean first() throws HibernateException {
! try {
! return rs.first();
! }
! catch (SQLException sqle) {
! throw new JDBCException(sqle);
! }
}
***************
*** 43,48 ****
* @see net.sf.hibernate.ScrollableResults#last()
*/
! public boolean last() throws SQLException, HibernateException {
! return rs.last();
}
--- 54,64 ----
* @see net.sf.hibernate.ScrollableResults#last()
*/
! public boolean last() throws HibernateException {
! try {
! return rs.last();
! }
! catch (SQLException sqle) {
! throw new JDBCException(sqle);
! }
}
***************
*** 50,55 ****
* @see net.sf.hibernate.ScrollableResults#advance()
*/
! public boolean next() throws SQLException, HibernateException {
! return rs.next();
}
--- 66,76 ----
* @see net.sf.hibernate.ScrollableResults#advance()
*/
! public boolean next() throws HibernateException {
! try {
! return rs.next();
! }
! catch (SQLException sqle) {
! throw new JDBCException(sqle);
! }
}
***************
*** 57,62 ****
* @see net.sf.hibernate.ScrollableResults#retreat()
*/
! public boolean previous() throws SQLException, HibernateException {
! return rs.previous();
}
--- 78,88 ----
* @see net.sf.hibernate.ScrollableResults#retreat()
*/
! public boolean previous() throws HibernateException {
! try {
! return rs.previous();
! }
! catch (SQLException sqle) {
! throw new JDBCException(sqle);
! }
}
***************
*** 64,71 ****
* @see net.sf.hibernate.ScrollableResults#get()
*/
! public Object[] get() throws SQLException, HibernateException {
Object[] row = new Object[types.length];
for (int i=0; i<types.length; i++) {
! row[i] = types[i].nullSafeGet( rs, names[i], sess, null );
}
return row;
--- 90,102 ----
* @see net.sf.hibernate.ScrollableResults#get()
*/
! public Object[] get() throws HibernateException {
Object[] row = new Object[types.length];
for (int i=0; i<types.length; i++) {
! try {
! row[i] = types[i].nullSafeGet( rs, names[i], sess, null );
! }
! catch (SQLException sqle) {
! throw new JDBCException(sqle);
! }
}
return row;
***************
*** 75,80 ****
* @see net.sf.hibernate.ScrollableResults#get(int)
*/
! public Object get(int col) throws SQLException, HibernateException {
! return types[col].nullSafeGet( rs, names[col], sess, null );
}
--- 106,116 ----
* @see net.sf.hibernate.ScrollableResults#get(int)
*/
! public Object get(int col) throws HibernateException {
! try {
! return types[col].nullSafeGet( rs, names[col], sess, null );
! }
! catch (SQLException sqle) {
! throw new JDBCException(sqle);
! }
}
***************
*** 103,107 ****
*/
public BigDecimal getBigDecimal(int col)
! throws SQLException, HibernateException {
return (BigDecimal) get(col);
}
--- 139,143 ----
*/
public BigDecimal getBigDecimal(int col)
! throws HibernateException {
return (BigDecimal) get(col);
}
***************
*** 110,114 ****
* @see net.sf.hibernate.ScrollableResults#getBinary(int)
*/
! public byte[] getBinary(int col) throws SQLException, HibernateException {
return (byte[]) get(col);
}
--- 146,150 ----
* @see net.sf.hibernate.ScrollableResults#getBinary(int)
*/
! public byte[] getBinary(int col) throws HibernateException {
return (byte[]) get(col);
}
***************
*** 117,121 ****
* @see net.sf.hibernate.ScrollableResults#getBlob(int)
*/
! public Blob getBlob(int col) throws SQLException, HibernateException {
return (Blob) get(col);
}
--- 153,157 ----
* @see net.sf.hibernate.ScrollableResults#getBlob(int)
*/
! public Blob getBlob(int col) throws HibernateException {
return (Blob) get(col);
}
***************
*** 124,128 ****
* @see net.sf.hibernate.ScrollableResults#getClob(int)
*/
! public Clob getClob(int col) throws SQLException, HibernateException {
return (Clob) get(col);
}
--- 160,164 ----
* @see net.sf.hibernate.ScrollableResults#getClob(int)
*/
! public Clob getClob(int col) throws HibernateException {
return (Clob) get(col);
}
***************
*** 131,135 ****
* @see net.sf.hibernate.ScrollableResults#getBoolean(int)
*/
! public Boolean getBoolean(int col) throws SQLException, HibernateException {
return (Boolean) get(col);
}
--- 167,171 ----
* @see net.sf.hibernate.ScrollableResults#getBoolean(int)
*/
! public Boolean getBoolean(int col) throws HibernateException {
return (Boolean) get(col);
}
***************
*** 138,142 ****
* @see net.sf.hibernate.ScrollableResults#getByte(int)
*/
! public Byte getByte(int col) throws SQLException, HibernateException {
return (Byte) get(col);
}
--- 174,178 ----
* @see net.sf.hibernate.ScrollableResults#getByte(int)
*/
! public Byte getByte(int col) throws HibernateException {
return (Byte) get(col);
}
***************
*** 145,149 ****
* @see net.sf.hibernate.ScrollableResults#getCharacter(int)
*/
! public Character getCharacter(int col) throws SQLException, HibernateException {
return (Character) get(col);
}
--- 181,185 ----
* @see net.sf.hibernate.ScrollableResults#getCharacter(int)
*/
! public Character getCharacter(int col) throws HibernateException {
return (Character) get(col);
}
***************
*** 152,160 ****
* @see net.sf.hibernate.ScrollableResults#getDate(int)
*/
! public Date getDate(int col) throws SQLException, HibernateException {
return (Date) get(col);
}
! public Calendar getCalendar(int col) throws SQLException, HibernateException {
return (Calendar) get(col);
}
--- 188,196 ----
* @see net.sf.hibernate.ScrollableResults#getDate(int)
*/
! public Date getDate(int col) throws HibernateException {
return (Date) get(col);
}
! public Calendar getCalendar(int col) throws HibernateException {
return (Calendar) get(col);
}
***************
*** 163,167 ****
* @see net.sf.hibernate.ScrollableResults#getDouble(int)
*/
! public Double getDouble(int col) throws SQLException, HibernateException {
return (Double) get(col);
}
--- 199,203 ----
* @see net.sf.hibernate.ScrollableResults#getDouble(int)
*/
! public Double getDouble(int col) throws HibernateException {
return (Double) get(col);
}
***************
*** 170,174 ****
* @see net.sf.hibernate.ScrollableResults#getFloat(int)
*/
! public Float getFloat(int col) throws SQLException, HibernateException {
return (Float) get(col);
}
--- 206,210 ----
* @see net.sf.hibernate.ScrollableResults#getFloat(int)
*/
! public Float getFloat(int col) throws HibernateException {
return (Float) get(col);
}
***************
*** 177,181 ****
* @see net.sf.hibernate.ScrollableResults#getInteger(int)
*/
! public Integer getInteger(int col) throws SQLException, HibernateException {
return (Integer) get(col);
}
--- 213,217 ----
* @see net.sf.hibernate.ScrollableResults#getInteger(int)
*/
! public Integer getInteger(int col) throws HibernateException {
return (Integer) get(col);
}
***************
*** 184,188 ****
* @see net.sf.hibernate.ScrollableResults#getLong(int)
*/
! public Long getLong(int col) throws SQLException, HibernateException {
return (Long) get(col);
}
--- 220,224 ----
* @see net.sf.hibernate.ScrollableResults#getLong(int)
*/
! public Long getLong(int col) throws HibernateException {
return (Long) get(col);
}
***************
*** 191,195 ****
* @see net.sf.hibernate.ScrollableResults#getShort(int)
*/
! public Short getShort(int col) throws SQLException, HibernateException {
return (Short) get(col);
}
--- 227,231 ----
* @see net.sf.hibernate.ScrollableResults#getShort(int)
*/
! public Short getShort(int col) throws HibernateException {
return (Short) get(col);
}
***************
*** 198,202 ****
* @see net.sf.hibernate.ScrollableResults#getString(int)
*/
! public String getString(int col) throws SQLException, HibernateException {
return (String) get(col);
}
--- 234,238 ----
* @see net.sf.hibernate.ScrollableResults#getString(int)
*/
! public String getString(int col) throws HibernateException {
return (String) get(col);
}
***************
*** 205,210 ****
* @see net.sf.hibernate.ScrollableResults#afterLast()
*/
! public void afterLast() throws SQLException, HibernateException {
! rs.afterLast();
}
--- 241,251 ----
* @see net.sf.hibernate.ScrollableResults#afterLast()
*/
! public void afterLast() throws HibernateException {
! try {
! rs.afterLast();
! }
! catch (SQLException sqle) {
! throw new JDBCException(sqle);
! }
}
***************
*** 212,217 ****
* @see net.sf.hibernate.ScrollableResults#beforeFirst()
*/
! public void beforeFirst() throws SQLException, HibernateException {
! rs.beforeFirst();
}
--- 253,263 ----
* @see net.sf.hibernate.ScrollableResults#beforeFirst()
*/
! public void beforeFirst() throws HibernateException {
! try {
! rs.beforeFirst();
! }
! catch (SQLException sqle) {
! throw new JDBCException(sqle);
! }
}
***************
*** 219,224 ****
* @see net.sf.hibernate.ScrollableResults#close()
*/
! public void close() throws SQLException, HibernateException {
! rs.close();
}
--- 265,275 ----
* @see net.sf.hibernate.ScrollableResults#close()
*/
! public void close() throws HibernateException {
! try {
! rs.close();
! }
! catch (SQLException sqle) {
! throw new JDBCException(sqle);
! }
}
***************
*** 226,230 ****
* @see net.sf.hibernate.ScrollableResults#getLocale(int)
*/
! public Locale getLocale(int col) throws SQLException, HibernateException {
return (Locale) get(col);
}
--- 277,281 ----
* @see net.sf.hibernate.ScrollableResults#getLocale(int)
*/
! public Locale getLocale(int col) throws HibernateException {
return (Locale) get(col);
}
***************
*** 233,237 ****
* @see net.sf.hibernate.ScrollableResults#getCurrency(int)
*/
! /*public Currency getCurrency(int col) throws SQLException, HibernateException {
return (Currency) get(col);
}*/
--- 284,288 ----
* @see net.sf.hibernate.ScrollableResults#getCurrency(int)
*/
! /*public Currency getCurrency(int col) throws HibernateException {
return (Currency) get(col);
}*/
***************
*** 240,244 ****
* @see net.sf.hibernate.ScrollableResults#getTimeZone(int)
*/
! public TimeZone getTimeZone(int col) throws SQLException, HibernateException {
return (TimeZone) get(col);
}
--- 291,295 ----
* @see net.sf.hibernate.ScrollableResults#getTimeZone(int)
*/
! public TimeZone getTimeZone(int col) throws HibernateException {
return (TimeZone) get(col);
}
***************
*** 255,260 ****
* @see net.sf.hibernate.ScrollableResults#isFirst()
*/
! public boolean isFirst() throws SQLException, HibernateException {
! return rs.isFirst();
}
--- 306,316 ----
* @see net.sf.hibernate.ScrollableResults#isFirst()
*/
! public boolean isFirst() throws HibernateException {
! try {
! return rs.isFirst();
! }
! catch (SQLException sqle) {
! throw new JDBCException(sqle);
! }
}
***************
*** 262,267 ****
* @see net.sf.hibernate.ScrollableResults#isLast()
*/
! public boolean isLast() throws SQLException, HibernateException {
! return rs.isLast();
}
--- 318,328 ----
* @see net.sf.hibernate.ScrollableResults#isLast()
*/
! public boolean isLast() throws HibernateException {
! try {
! return rs.isLast();
! }
! catch (SQLException sqle) {
! throw new JDBCException(sqle);
! }
}
Index: SessionFactoryImpl.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/SessionFactoryImpl.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** SessionFactoryImpl.java 5 Jan 2003 02:11:21 -0000 1.4
--- SessionFactoryImpl.java 14 Jan 2003 13:42:13 -0000 1.5
***************
*** 2,6 ****
package net.sf.hibernate.impl;
- import java.util.HashMap;
import java.io.FileInputStream;
import java.io.IOException;
--- 2,5 ----
***************
*** 18,37 ****
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
- import java.util.Collections;
import javax.xml.transform.Templates;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerFactoryConfigurationError;
import javax.xml.transform.stream.StreamSource;
- import javax.naming.NamingException;
- import javax.naming.Reference;
- import javax.naming.StringRefAddr;
-
- import org.apache.commons.logging.Log;
- import org.apache.commons.logging.LogFactory;
- import org.apache.commons.collections.ReferenceMap;
import net.sf.hibernate.AssertionFailure;
--- 17,33 ----
import java.sql.SQLException;
import java.util.ArrayList;
+ import java.util.Collections;
+ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
+ import javax.naming.NamingException;
+ import javax.naming.Reference;
+ import javax.naming.StringRefAddr;
import javax.xml.transform.Templates;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.TransformerFactoryConfigurationError;
import javax.xml.transform.stream.StreamSource;
import net.sf.hibernate.AssertionFailure;
***************
*** 40,43 ****
--- 36,40 ----
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Interceptor;
+ import net.sf.hibernate.JDBCException;
import net.sf.hibernate.MappingException;
import net.sf.hibernate.QueryException;
***************
*** 45,56 ****
import net.sf.hibernate.SessionFactory;
import net.sf.hibernate.cache.Timestamper;
! import net.sf.hibernate.collection.*;
import net.sf.hibernate.connection.ConnectionProvider;
import net.sf.hibernate.connection.ConnectionProviderFactory;
! import net.sf.hibernate.engine.*;
! import net.sf.hibernate.util.JDBCExceptionReporter;
! import net.sf.hibernate.util.PropertiesHelper;
! import net.sf.hibernate.util.ReflectHelper;
! import net.sf.hibernate.util.StringHelper;
import net.sf.hibernate.id.IdentifierGenerator;
import net.sf.hibernate.id.UUIDHexGenerator;
--- 42,53 ----
import net.sf.hibernate.SessionFactory;
import net.sf.hibernate.cache.Timestamper;
! import net.sf.hibernate.collection.CollectionPersister;
import net.sf.hibernate.connection.ConnectionProvider;
import net.sf.hibernate.connection.ConnectionProviderFactory;
! import net.sf.hibernate.dialect.Dialect;
! import net.sf.hibernate.dialect.GenericDialect;
! import net.sf.hibernate.engine.SessionFactoryImplementor;
! import net.sf.hibernate.hql.FilterTranslator;
! import net.sf.hibernate.hql.QueryTranslator;
import net.sf.hibernate.id.IdentifierGenerator;
import net.sf.hibernate.id.UUIDHexGenerator;
***************
*** 59,73 ****
import net.sf.hibernate.metadata.ClassMetadata;
import net.sf.hibernate.metadata.CollectionMetadata;
! import net.sf.hibernate.persister.*;
! import net.sf.hibernate.ps.*;
! import net.sf.hibernate.hql.FilterTranslator;
! import net.sf.hibernate.hql.QueryTranslator;
! import net.sf.hibernate.dialect.Dialect;
! import net.sf.hibernate.dialect.GenericDialect;
import net.sf.hibernate.transaction.JDBCTransactionFactory;
import net.sf.hibernate.transaction.TransactionFactory;
import net.sf.hibernate.type.Type;
import net.sf.hibernate.xml.XMLDatabinder;
/**
* Concrete implementation of a SessionFactory
--- 56,77 ----
import net.sf.hibernate.metadata.ClassMetadata;
import net.sf.hibernate.metadata.CollectionMetadata;
! import net.sf.hibernate.persister.ClassPersister;
! import net.sf.hibernate.persister.EntityPersister;
! import net.sf.hibernate.persister.MultiTableEntityPersister;
! import net.sf.hibernate.persister.Queryable;
! import net.sf.hibernate.ps.PreparedStatementCache;
import net.sf.hibernate.transaction.JDBCTransactionFactory;
import net.sf.hibernate.transaction.TransactionFactory;
import net.sf.hibernate.type.Type;
+ import net.sf.hibernate.util.JDBCExceptionReporter;
+ import net.sf.hibernate.util.PropertiesHelper;
+ import net.sf.hibernate.util.ReflectHelper;
+ import net.sf.hibernate.util.StringHelper;
import net.sf.hibernate.xml.XMLDatabinder;
+ import org.apache.commons.collections.ReferenceMap;
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+
/**
* Concrete implementation of a SessionFactory
***************
*** 209,213 ****
collectionPersisters.put(
map.getRole(),
! new CollectionPersister(map, datastore, defaultSchema, this)
);
}
--- 213,217 ----
collectionPersisters.put(
map.getRole(),
! new CollectionPersister(map, datastore, this)
);
}
***************
*** 333,337 ****
}
! public Session openSession(Interceptor interceptor) throws SQLException {
long timestamp = Timestamper.next();//System.currentTimeMillis();
return openSession( null, true, timestamp, interceptor );
--- 337,341 ----
}
! public Session openSession(Interceptor interceptor) throws HibernateException {
long timestamp = Timestamper.next();//System.currentTimeMillis();
return openSession( null, true, timestamp, interceptor );
***************
*** 342,356 ****
}
! public Session openSession() throws SQLException {
return openSession(interceptor);
}
! public Connection openConnection() throws SQLException {
! return connections.getConnection();
}
! public void closeConnection(Connection conn) throws SQLException {
! JDBCExceptionReporter.logWarnings( conn.getWarnings() );
! conn.clearWarnings();
! connections.closeConnection(conn);
}
--- 346,370 ----
}
! public Session openSession() throws HibernateException {
return openSession(interceptor);
}
! public Connection openConnection() throws HibernateException {
! try {
! return connections.getConnection();
! }
! catch (SQLException sqle) {
! throw new JDBCException("Cannot open connection", sqle);
! }
}
! public void closeConnection(Connection conn) throws HibernateException {
! try {
! JDBCExceptionReporter.logWarnings( conn.getWarnings() );
! conn.clearWarnings();
! connections.closeConnection(conn);
! }
! catch (SQLException sqle) {
! throw new JDBCException("Cannot close connection", sqle);
! }
}
Index: SessionImpl.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/SessionImpl.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** SessionImpl.java 9 Jan 2003 12:24:51 -0000 1.7
--- SessionImpl.java 14 Jan 2003 13:42:13 -0000 1.8
***************
*** 28,31 ****
--- 28,32 ----
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Interceptor;
+ import net.sf.hibernate.JDBCException;
import net.sf.hibernate.Lifecycle;
import net.sf.hibernate.LockMode;
***************
*** 353,357 ****
}
! public Connection close() throws HibernateException, SQLException {
log.trace("closing session");
--- 354,358 ----
}
! public Connection close() throws HibernateException {
log.trace("closing session");
***************
*** 486,490 ****
* object and returned.
*/
! public Serializable save(Object object) throws SQLException, HibernateException {
if (object==null) throw new NullPointerException("attempted to save null");
--- 487,491 ----
* object and returned.
*/
! public Serializable save(Object object) throws HibernateException {
if (object==null) throw new NullPointerException("attempted to save null");
***************
*** 496,500 ****
}
else {
! Serializable id = getPersister(object).getIdentifierGenerator().generate(this, object);
return doSave(object, id);
}
--- 497,507 ----
}
else {
! Serializable id;
! try {
! id = getPersister(object).getIdentifierGenerator().generate(this, object);
! }
! catch (SQLException sqle) {
! throw new JDBCException("Could not save object", sqle);
! }
return doSave(object, id);
}
***************
*** 504,508 ****
* Save a transient object with a manually assigned ID.
*/
! public void save(Object object, Serializable id) throws SQLException, HibernateException {
if (object==null) throw new NullPointerException("attempted to insert null");
--- 511,515 ----
* Save a transient object with a manually assigned ID.
*/
! public void save(Object object, Serializable id) throws HibernateException {
if (object==null) throw new NullPointerException("attempted to insert null");
***************
*** 522,526 ****
}
! private Serializable doSave(Object object, Serializable id) throws SQLException, HibernateException {
ClassPersister persister = getPersister(object);
--- 529,533 ----
}
! private Serializable doSave(Object object, Serializable id) throws HibernateException {
ClassPersister persister = getPersister(object);
***************
*** 567,571 ****
// cascade-save to many-to-one BEFORE the parent is saved
-
Cascades.cascade(this, persister, object, Cascades.ACTION_SAVE_UPDATE, Cascades.CASCADE_BEFORE_INSERT_AFTER_DELETE);
--- 574,577 ----
***************
*** 587,591 ****
if (identityCol) {
! id = persister.insert(values, object, this);
key = new Key(id, persister);
--- 593,602 ----
if (identityCol) {
! try {
! id = persister.insert(values, object, this);
! }
! catch (SQLException sqle) {
! throw new JDBCException("Could not insert", sqle);
! }
key = new Key(id, persister);
***************
*** 657,664 ****
object = li.getImplementation();
}
- catch (SQLException sqle) {
- //does not occur
- throw new AssertionFailure("Unexpected SQLException occurred in isTransient()", sqle);
- }
catch (HibernateException he) {
//does not occur
--- 668,671 ----
***************
*** 710,714 ****
* Delete a persistent object
*/
! public void delete(Object object) throws SQLException, HibernateException {
if (object==null) throw new NullPointerException("attempted to delete null");
--- 717,721 ----
* Delete a persistent object
*/
! public void delete(Object object) throws HibernateException {
if (object==null) throw new NullPointerException("attempted to delete null");
***************
*** 865,869 ****
! private void removeCollectionsFor(ClassPersister persister, Serializable id, Object object) throws SQLException, HibernateException {
if ( persister.hasCollections() ) {
Type[] types = persister.getPropertyTypes();
--- 872,876 ----
! private void removeCollectionsFor(ClassPersister persister, Serializable id, Object object) throws HibernateException {
if ( persister.hasCollections() ) {
Type[] types = persister.getPropertyTypes();
***************
*** 876,880 ****
//TODO: rename this method
! private void removeCollectionsFor(Type type, Serializable id, Object value) throws SQLException, HibernateException {
if ( type.isPersistentCollectionType() ) {
CollectionPersister role = getCollectionPersister( ( (PersistentCollectionType) type ).getRole() );
--- 883,887 ----
//TODO: rename this method
! private void removeCollectionsFor(Type type, Serializable id, Object value) throws HibernateException {
if ( type.isPersistentCollectionType() ) {
CollectionPersister role = getCollectionPersister( ( (PersistentCollectionType) type ).getRole() );
***************
*** 909,913 ****
//deprecated:
! public void update(Object obj) throws SQLException, HibernateException {
if (obj==null) throw new NullPointerException("attempted to update null");
--- 916,920 ----
//deprecated:
! public void update(Object obj) throws HibernateException {
if (obj==null) throw new NullPointerException("attempted to update null");
***************
*** 943,947 ****
}
! public void saveOrUpdate(Object obj) throws SQLException, HibernateException {
if (obj==null) throw new NullPointerException("attempted to update null");
Object object = HibernateProxyHelper.unproxy(obj, this);
--- 950,954 ----
}
! public void saveOrUpdate(Object obj) throws HibernateException {
if (obj==null) throw new NullPointerException("attempted to update null");
Object object = HibernateProxyHelper.unproxy(obj, this);
***************
*** 976,980 ****
}
! public void update(Object obj, Serializable id) throws SQLException, HibernateException {
if (id==null) throw new NullPointerException("null is not a valid identifier");
if (obj==null) throw new NullPointerException("attempted to update null");
--- 983,987 ----
}
! public void update(Object obj, Serializable id) throws HibernateException {
if (id==null) throw new NullPointerException("null is not a valid identifier");
if (obj==null) throw new NullPointerException("attempted to update null");
***************
*** 994,998 ****
}
! private void doUpdate(Object object, Object proxy, Serializable id) throws SQLException, HibernateException {
ClassPersister persister = getPersister(object);
--- 1001,1005 ----
}
! private void doUpdate(Object object, Object proxy, Serializable id) throws HibernateException {
ClassPersister persister = getPersister(object);
***************
*** 1040,1056 ****
* Retrieve a list of persistent objects using a hibernate query
*/
! public List find(String query) throws SQLException, HibernateException {
return find(query, NO_ARGS, NO_TYPES);
}
! public List find(String query, Object value, Type type) throws SQLException, HibernateException {
return find( query, new Object[] { value }, new Type[] { type } );
}
! public List find(String query, Object[] values, Type[] types) throws SQLException, HibernateException {
return find(query, values, types, null, null);
}
! public List find(String query, Object[] values, Type[] types, RowSelection selection, Map namedParams) throws SQLException, HibernateException {
if ( log.isTraceEnabled() ) {
--- 1047,1063 ----
* Retrieve a list of persistent objects using a hibernate query
*/
! public List find(String query) throws HibernateException {
return find(query, NO_ARGS, NO_TYPES);
}
! public List find(String query, Object value, Type type) throws HibernateException {
return find( query, new Object[] { value }, new Type[] { type } );
}
! public List find(String query, Object[] values, Type[] types) throws HibernateException {
return find(query, values, types, null, null);
}
! public List find(String query, Object[] values, Type[] types, RowSelection selection, Map namedParams) throws HibernateException {
if ( log.isTraceEnabled() ) {
***************
*** 1068,1073 ****
try {
for ( int i=0; i<q.length; i++ ) {
!
! List currentResults = q[i].find(this, values, types, true, selection, namedParams);
currentResults.addAll(results);
results = currentResults;
--- 1075,1085 ----
try {
for ( int i=0; i<q.length; i++ ) {
! List currentResults;
! try {
! currentResults = q[i].find(this, values, types, true, selection, namedParams);
! }
! catch (SQLException sqle) {
! throw new JDBCException("Could not execute query", sqle);
! }
currentResults.addAll(results);
results = currentResults;
***************
*** 1080,1084 ****
}
! private QueryTranslator[] getQueries(String query, boolean scalar) throws HibernateException, SQLException {
// a query that names an interface or unmapped class in the from clause
--- 1092,1096 ----
}
! private QueryTranslator[] getQueries(String query, boolean scalar) throws HibernateException {
// a query that names an interface or unmapped class in the from clause
***************
*** 1099,1115 ****
}
! public Iterator iterate(String query) throws HibernateException, SQLException {
return iterate(query, NO_ARGS, NO_TYPES);
}
! public Iterator iterate(String query, Object value, Type type) throws HibernateException, SQLException {
return iterate( query, new Object[] { value }, new Type[] { type } );
}
! public Iterator iterate(String query, Object[] values, Type[] types) throws HibernateException, SQLException {
return iterate(query, values, types, null, null);
}
! public Iterator iterate(String query, Object[] values, Type[] types, RowSelection selection, Map namedParams) throws HibernateException, SQLException {
if ( log.isTraceEnabled() ) {
--- 1111,1127 ----
}
! public Iterator iterate(String query) throws HibernateException {
return iterate(query, NO_ARGS, NO_TYPES);
}
! public Iterator iterate(String query, Object value, Type type) throws HibernateException {
return iterate( query, new Object[] { value }, new Type[] { type } );
}
! public Iterator iterate(String query, Object[] values, Type[] types) throws HibernateException {
return iterate(query, values, types, null, null);
}
! public Iterator iterate(String query, Object[] values, Type[] types, RowSelection selection, Map namedParams) throws HibernateException {
if ( log.isTraceEnabled() ) {
***************
*** 1130,1134 ****
for ( int i=0; i<q.length; i++ ) {
! result = q[i].iterate(values, types, selection, namedParams, this);
if ( many ) {
results[i] = result;
--- 1142,1151 ----
for ( int i=0; i<q.length; i++ ) {
! try {
! result = q[i].iterate(values, types, selection, namedParams, this);
! }
! catch (SQLException sqle) {
! throw new JDBCException("Could not execute query", sqle);
! }
if ( many ) {
results[i] = result;
***************
*** 1140,1144 ****
}
! public ScrollableResults scroll(String query, Object[] values, Type[] types, RowSelection selection, Map namedParams) throws HibernateException, SQLException {
if ( log.isTraceEnabled() ) {
--- 1157,1161 ----
}
! public ScrollableResults scroll(String query, Object[] values, Type[] types, RowSelection selection, Map namedParams) throws HibernateException {
if ( log.isTraceEnabled() ) {
***************
*** 1151,1166 ****
QueryTranslator q = factory.getShallowQuery( concreteQueries[0] );
autoFlushIfRequired( q.getQuerySpaces() );
! return q.scroll(values, types, selection, namedParams, this);
}
! public int delete(String query) throws HibernateException, SQLException {
return delete(query, NO_ARGS, NO_TYPES);
}
! public int delete(String query, Object value, Type type) throws HibernateException, SQLException {
return delete( query, new Object[] { value }, new Type[] { type } );
}
! public int delete(String query, Object[] values, Type[] types) throws HibernateException, SQLException {
if ( log.isTraceEnabled() ) {
--- 1168,1188 ----
QueryTranslator q = factory.getShallowQuery( concreteQueries[0] );
autoFlushIfRequired( q.getQuerySpaces() );
! try {
! return q.scroll(values, types, selection, namedParams, this);
! }
! catch (SQLException sqle) {
! throw new JDBCException("Could not execute query", sqle);
! }
}
! public int delete(String query) throws HibernateException {
return delete(query, NO_ARGS, NO_TYPES);
}
! public int delete(String query, Object value, Type type) throws HibernateException {
return delete( query, new Object[] { value }, new Type[] { type } );
}
! public int delete(String query, Object[] values, Type[] types) throws HibernateException {
if ( log.isTraceEnabled() ) {
***************
*** 1175,1179 ****
}
! public void lock(Object object, LockMode lockMode) throws SQLException, HibernateException {
if (object==null) throw new NullPointerException("attempted to lock null");
--- 1197,1201 ----
}
! public void lock(Object object, LockMode lockMode) throws HibernateException {
if (object==null) throw new NullPointerException("attempted to lock null");
***************
*** 1198,1201 ****
--- 1220,1226 ----
e.lockMode = lockMode;
}
+ catch (SQLException sqle) {
+ throw new JDBCException("Could not lock object", sqle);
+ }
finally {
// the database now holds a lock + the object is flushed from the cache,
***************
*** 1226,1230 ****
}
! private boolean autoFlushIfRequired(Set querySpaces) throws HibernateException, SQLException {
if ( flushMode==FlushMode.AUTO && dontFlushFromFind==0 ) {
--- 1251,1255 ----
}
! private boolean autoFlushIfRequired(Set querySpaces) throws HibernateException {
if ( flushMode==FlushMode.AUTO && dontFlushFromFind==0 ) {
***************
*** 1349,1358 ****
}
! public void load(Object object, Serializable id) throws SQLException, HibernateException {
if (id==null) throw new NullPointerException("null is not a valid identifier");
doLoadByObject(object, id, true);
}
! public Object load(Class clazz, Serializable id) throws SQLException, HibernateException {
if (id==null) throw new NullPointerException("null is not a valid identifier");
Object result = doLoadByClass(clazz, id, true, true);
--- 1374,1383 ----
}
! public void load(Object object, Serializable id) throws HibernateException {
if (id==null) throw new NullPointerException("null is not a valid identifier");
doLoadByObject(object, id, true);
}
! public Object load(Class clazz, Serializable id) throws HibernateException {
if (id==null) throw new NullPointerException("null is not a valid identifier");
Object result = doLoadByClass(clazz, id, true, true);
***************
*** 1395,1399 ****
* as the application is concerned.
*/
! private void doLoadByObject(Object object, Serializable id, boolean checkDeleted) throws SQLException, HibernateException {
Class clazz = object.getClass();
--- 1420,1424 ----
* as the application is concerned.
*/
! private void doLoadByObject(Object object, Serializable id, boolean checkDeleted) throws HibernateException {
Class clazz = object.getClass();
***************
*** 1417,1421 ****
* later. This should return an existing proxy where appropriate.
*/
! private Object doLoadByClass(Class clazz, Serializable id, boolean checkDeleted, boolean allowProxyCreation) throws SQLException, HibernateException {
if ( log.isTraceEnabled() ) log.trace( "loading " + infoString(clazz, id) );
--- 1442,1446 ----
* later. This should return an existing proxy where appropriate.
*/
! private Object doLoadByClass(Class clazz, Serializable id, boolean checkDeleted, boolean allowProxyCreation) throws HibernateException {
if ( log.isTraceEnabled() ) log.trace( "loading " + infoString(clazz, id) );
***************
*** 1460,1464 ****
}
! public Object loadWithLock(Class clazz, Serializable id) throws SQLException, HibernateException {
return load(clazz, id, LockMode.UPGRADE);
}
--- 1485,1489 ----
}
! public Object loadWithLock(Class clazz, Serializable id) throws HibernateException {
return load(clazz, id, LockMode.UPGRADE);
}
***************
*** 1469,1473 ****
* This should return an existing proxy where appropriate.
*/
! public Object load(Class clazz, Serializable id, LockMode lockMode) throws SQLException, HibernateException {
if (lockMode==LockMode.WRITE) throw new HibernateException("Invalid lock mode for load()");
--- 1494,1498 ----
* This should return an existing proxy where appropriate.
*/
! public Object load(Class clazz, Serializable id, LockMode lockMode) throws HibernateException {
if (lockMode==LockMode.WRITE) throw new HibernateException("Invalid lock mode for load()");
***************
*** 1507,1511 ****
LockMode lockMode,
boolean checkDeleted
! ) throws SQLException, HibernateException {
//DONT need to flush before a load by id
--- 1532,1536 ----
LockMode lockMode,
boolean checkDeleted
! ) throws HibernateException {
//DONT need to flush before a load by id
***************
*** 1537,1541 ****
addEntry(result, LOADING, null, id, null, LockMode.NONE, true, subclassPersister); //make it circular-reference safe
addEntity( new Key(id, persister), result );
! Object[] values = entry.assemble(result, id, subclassPersister, this); // intializes cached by side-effect
Type[] types = subclassPersister.getPropertyTypes();
TypeFactory.deepCopy(values, types, values);
--- 1562,1572 ----
addEntry(result, LOADING, null, id, null, LockMode.NONE, true, subclassPersister); //make it circular-reference safe
addEntity( new Key(id, persister), result );
! Object[] values;
! try {
! values = entry.assemble(result, id, subclassPersister, this); // intializes cached by side-effect
! }
! catch (SQLException sqle) {
! throw new JDBCException("Could not reassemble cached object", sqle);
! }
Type[] types = subclassPersister.getPropertyTypes();
TypeFactory.deepCopy(values, types, values);
***************
*** 1553,1557 ****
//otherwise go ahead and load it!
// Note: you can't use "for update" with an outer join
! return persister.load(id, optionalObject, lockMode, this);
}
--- 1584,1593 ----
//otherwise go ahead and load it!
// Note: you can't use "for update" with an outer join
! try {
! return persister.load(id, optionalObject, lockMode, this);
! }
! catch (SQLException sqle) {
! throw new JDBCException("Could not load object", sqle);
! }
}
***************
*** 1561,1565 ****
}
! public void refresh(Object object) throws SQLException, HibernateException {
if (object==null) throw new NullPointerException("attempted to refresh null");
--- 1597,1601 ----
}
! public void refresh(Object object) throws HibernateException {
if (object==null) throw new NullPointerException("attempted to refresh null");
***************
*** 1571,1575 ****
removeEntity( new Key(e.id, e.persister) );
! e.persister.load( e.id, object, LockMode.READ, this);
getEntry(object).lockMode = e.lockMode;
}
--- 1607,1616 ----
removeEntity( new Key(e.id, e.persister) );
! try {
! e.persister.load( e.id, object, LockMode.READ, this);
! }
! catch (SQLException sqle) {
! throw new JDBCException("Could not refresh object", sqle);
! }
getEntry(object).lockMode = e.lockMode;
}
***************
*** 1621,1625 ****
* holding. If they had a nonpersistable collection, substitute a persistable one
*/
! public void flush() throws SQLException, HibernateException {
flushEverything();
execute();
--- 1662,1666 ----
* holding. If they had a nonpersistable collection, substitute a persistable one
*/
! public void flush() throws HibernateException {
flushEverything();
execute();
***************
*** 1627,1631 ****
}
! private void flushEverything() throws HibernateException, SQLException {
log.trace("flushing session");
--- 1668,1672 ----
}
! private void flushEverything() throws HibernateException {
log.trace("flushing session");
***************
*** 1674,1687 ****
! private void execute() throws SQLException, HibernateException {
log.trace("Executing");
! executeAll( insertions.iterator() );
! executeAll( updates.values().iterator() );
! executeAll( collectionRemovals.iterator() );
! executeAll( collectionUpdates.iterator() );
! executeAll( collectionCreations.iterator() );
! executeAll( deletions.iterator() );
}
--- 1715,1733 ----
! private void execute() throws HibernateException {
log.trace("Executing");
! try {
! executeAll( insertions.iterator() );
! executeAll( updates.values().iterator() );
! executeAll( collectionRemovals.iterator() );
! executeAll( collectionUpdates.iterator() );
! executeAll( collectionCreations.iterator() );
! executeAll( deletions.iterator() );
! }
! catch (SQLException sqle) {
! throw new JDBCException("Could not synchronize database state with session", sqle);
! }
}
***************
*** 1704,1708 ****
}
! private void flushEntities() throws HibernateException, SQLException {
log.trace("Flushing entities and processing referenced collections");
--- 1750,1754 ----
}
! private void flushEntities() throws HibernateException {
log.trace("Flushing entities and processing referenced collections");
***************
*** 1835,1839 ****
}
! private void preFlushEntities() throws HibernateException, SQLException {
Iterator iter = entries.entrySet().iterator();
--- 1881,1885 ----
}
! private void preFlushEntities() throws HibernateException {
Iterator iter = entries.entrySet().iterator();
***************
*** 1896,1900 ****
// COLLECTIONS ///////////////////////////////////////////////////////////////////
! private void flushCollections() throws HibernateException, SQLException {
log.trace("Processing unreferenced collections");
--- 1942,1946 ----
// COLLECTIONS ///////////////////////////////////////////////////////////////////
! private void flushCollections() throws HibernateException {
log.trace("Processing unreferenced collections");
***************
*** 2028,2032 ****
* circular or shared references between/to collections.
*/
! private void updateReachableCollection(PersistentCollection coll, Type type, Object owner) throws HibernateException, SQLException {
CollectionEntry ce = getCollectionEntry(coll);
--- 2074,2078 ----
* circular or shared references between/to collections.
*/
! private void updateReachableCollection(PersistentCollection coll, Type type, Object owner) throws HibernateException {
CollectionEntry ce = getCollectionEntry(coll);
***************
*** 2058,2062 ****
* If so, recursively update contained collections
*/
! private void updateReachable(Object obj, Type type, Object owner) throws HibernateException, SQLException {
// This method assumes wrap was already called on obj!
--- 2104,2108 ----
* If so, recursively update contained collections
*/
! private void updateReachable(Object obj, Type type, Object owner) throws HibernateException {
// This method assumes wrap was already called on obj!
***************
*** 2089,2093 ****
}
! private void updateUnreachableCollection(PersistentCollection coll) throws HibernateException, SQLException {
CollectionEntry entry = getCollectionEntry(coll);
if ( log.isDebugEnabled() && entry.loadedPersister!=null ) log.debug(
--- 2135,2139 ----
}
! private void updateUnreachableCollection(PersistentCollection coll) throws HibernateException {
CollectionEntry entry = getCollectionEntry(coll);
if ( log.isDebugEnabled() && entry.loadedPersister!=null ) log.debug(
***************
*** 2101,2105 ****
}
! private void prepareCollectionForUpdate(PersistentCollection coll, CollectionEntry entry) throws HibernateException, SQLException {
if (entry.processed) throw new AssertionFailure("Hibernate has a bug processing collections");
--- 2147,2151 ----
}
! private void prepareCollectionForUpdate(PersistentCollection coll, CollectionEntry entry) throws HibernateException {
if (entry.processed) throw new AssertionFailure("Hibernate has a bug processing collections");
***************
*** 2136,2140 ****
* Given an array of fields, search recursively for collections and update them
*/
! private void updateReachables( Object[] fields, Type[] types, Object owner ) throws HibernateException, SQLException {
// This method assumes wrap was already called on fields
--- 2182,2186 ----
* Given an array of fields, search recursively for collections and update them
*/
! private void updateReachables( Object[] fields, Type[] types, Object owner ) throws HibernateException {
// This method assumes wrap was already called on fields
***************
*** 2265,2269 ****
}
! public Connection connection() throws HibernateException, SQLException {
if (connection==null) {
if (connect) {
--- 2311,2315 ----
}
! public Connection connection() throws HibernateException {
if (connection==null) {
if (connect) {
***************
*** 2282,2286 ****
}
! public Connection disconnect() throws HibernateException, SQLException {
log.debug("disconnecting session");
--- 2328,2332 ----
}
! public Connection disconnect() throws HibernateException {
log.debug("disconnecting session");
***************
*** 2316,2320 ****
}
! public void reconnect() throws SQLException, HibernateException {
if ( isConnected() ) throw new HibernateException("Session already connected");
--- 2362,2366 ----
}
! public void reconnect() throws HibernateException {
if ( isConnected() ) throw new HibernateException("Session already connected");
***************
*** 2351,2358 ****
}
! public static void handle(Exception e) throws SQLException, HibernateException {
! if (e instanceof SQLException) {
! throw (SQLException) e;
! }
if (e instanceof HibernateException) {
throw (HibernateException) e;
--- 2397,2401 ----
}
! public static void handle(Exception e) throws HibernateException {
if (e instanceof HibernateException) {
throw (HibernateException) e;
***************
*** 2367,2379 ****
* @see net.sf.hibernate.Session#filter(Collection, String)
*/
! public Collection filter(Object collection, String filter) throws SQLException, HibernateException {
return filter( collection, filter, new Object[1], new Type[1], null, null );
}
! public Collection filter(Object collection, String filter, Object value, Type type) throws SQLException, HibernateException {
return filter(collection, filter, new Object[] { null, value }, new Type[] { null, type }, null, null );
}
! public Collection filter(Object collection, String filter, Object[] values, Type[] types) throws SQLException, HibernateException {
Object[] vals = new Object[ values.length + 1 ];
Type[] typs = new Type[ types.length + 1];
--- 2410,2422 ----
* @see net.sf.hibernate.Session#filter(Collection, String)
*/
! public Collection filter(Object collection, String filter) throws HibernateException {
return filter( collection, filter, new Object[1], new Type[1], null, null );
}
! public Collection filter(Object collection, String filter, Object value, Type type) throws HibernateException {
return filter(collection, filter, new Object[] { null, value }, new Type[] { null, type }, null, null );
}
! public Collection filter(Object collection, String filter, Object[] values, Type[] types) throws HibernateException {
Object[] vals = new Object[ values.length + 1 ];
Type[] typs = new Type[ types.length + 1];
***************
*** 2384,2388 ****
! private FilterTranslator getFilterTranslator(Object collection, String filter, Object[] values, Type[] types, RowSelection selection, Map namedParams, boolean scalar) throws SQLException, HibernateException {
if ( log.isTraceEnabled() ) {
--- 2427,2431 ----
! private FilterTranslator getFilterTranslator(Object collection, String filter, Object[] values, Type[] types, RowSelection selection, Map namedParams, boolean scalar) throws HibernateException {
if ( log.isTraceEnabled() ) {
***************
*** 2421,2425 ****
}
! public List filter(Object collection, String filter, Object[] values, Type[] types, RowSelection selection, Map namedParams) throws SQLException, HibernateException {
String[] concreteFilters = QueryTranslator.concreteQueries(filter, factory);
--- 2464,2468 ----
}
! public List filter(Object collection, String filter, Object[] values, Type[] types, RowSelection selection, Map namedParams) throws HibernateException {
String[] concreteFilters = QueryTranslator.concreteQueries(filter, factory);
***************
*** 2435,2439 ****
try {
for ( int i=0; i<concreteFilters.length; i++ ) {
! List currentResults = filters[i].find(this, values, types, true, selection, namedParams);
currentResults.addAll(results);
results = currentResults;
--- 2478,2488 ----
try {
for ( int i=0; i<concreteFilters.length; i++ ) {
! List currentResults;
! try {
! currentResults = filters[i].find(this, values, types, true, selection, namedParams);
! }
! catch (SQLException sqle) {
! throw new JDBCException("Could not execute query", sqle);
! }
currentResults.addAll(results);
results = currentResults;
***************
*** 2447,2451 ****
}
! public Iterator iterateFilter(Object collection, String filter, Object[] values, Type[] types, RowSelection selection, Map namedParams) throws SQLException, HibernateException {
String[] concreteFilters = QueryTranslator.concreteQueries(filter, factory);
--- 2496,2500 ----
}
! public Iterator iterateFilter(Object collection, String filter, Object[] values, Type[] types, RowSelection selection, Map namedParams) throws HibernateException {
String[] concreteFilters = QueryTranslator.concreteQueries(filter, factory);
***************
*** 2466,2470 ****
for ( int i=0; i<filters.length; i++ ) {
! result = filters[i].iterate(values, types, selection, namedParams, this);
if ( many ) {
results[i] = result;
--- 2515,2524 ----
for ( int i=0; i<filters.length; i++ ) {
! try {
! result = filters[i].iterate(values, types, selection, namedParams, this);
! }
! catch (SQLException sqle) {
! throw new JDBCException("Could not execute query", sqle);
! }
if ( many ) {
results[i] = result;
|