From: <one...@us...> - 2003-01-03 13:36:04
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection In directory sc8-pr-cvs1:/tmp/cvs-serv2643/src/net/sf/hibernate/collection Modified Files: ArrayHolder.java Bag.java List.java Map.java PersistentCollection.java Set.java SortedMap.java SortedSet.java Added Files: CollectionPersister.java Log Message: removed exceptions that occur if an object is saved or deleted multiple times in a session added <parent> subelement to <composite-element> and <nested-composite-element> --- NEW FILE: CollectionPersister.java --- //$Id: CollectionPersister.java,v 1.1 2003/01/03 13:36:00 oneovthafew Exp $ package net.sf.hibernate.collection; import java.io.InvalidObjectException; import java.io.ObjectStreamException; import java.io.Serializable; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Iterator; import java.util.StringTokenizer; import net.sf.hibernate.HibernateException; import net.sf.hibernate.MappingException; import net.sf.hibernate.cache.CacheConcurrencyStrategy; import net.sf.hibernate.cache.CacheException; import net.sf.hibernate.engine.SessionFactoryImplementor; import net.sf.hibernate.engine.SessionImplementor; import net.sf.hibernate.impl.DatastoreImpl; import net.sf.hibernate.loader.CollectionInitializer; import net.sf.hibernate.loader.CollectionLoader; import net.sf.hibernate.loader.OneToManyLoader; import net.sf.hibernate.loader.OuterJoinLoader; import net.sf.hibernate.mapping.Collection; import net.sf.hibernate.mapping.Column; import net.sf.hibernate.mapping.IndexedCollection; import net.sf.hibernate.mapping.PersistentClass; import net.sf.hibernate.mapping.Table; import net.sf.hibernate.metadata.CollectionMetadata; import net.sf.hibernate.type.EntityType; import net.sf.hibernate.type.PersistentCollectionType; import net.sf.hibernate.type.Type; import net.sf.hibernate.util.JDBCExceptionReporter; import net.sf.hibernate.util.StringHelper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Plugs into an instance of <tt>PersistentCollection</tt>, in order to * implement persistence of that collection while in a particular role. * * May be considered an immutable view of the mapping object */ public final class CollectionPersister implements Serializable, CollectionMetadata { private transient final String sqlSelectString; private transient final String sqlDeleteString; //private transient final String sqlSelectRowString; private transient final String sqlInsertRowString; private transient final String sqlUpdateRowString; private transient final String sqlDeleteRowString; private transient final String sqlOrderByString; private transient final boolean hasOrder; private transient final boolean isSet; private transient final Type keyType; private transient final Type indexType; private transient final Type elementType; private transient final String[] keyColumnNames; private transient final String[] indexColumnNames; private transient final String[] unquotedIndexColumnNames; private transient final String[] elementColumnNames; private transient final String[] unquotedElementColumnNames; private transient final String[] rowSelectColumnNames; private transient final Type rowSelectType; private transient final boolean primitiveArray; private transient final boolean array; private transient final boolean isOneToMany; private transient final String qualifiedTableName; private transient final boolean hasIndex; private transient final boolean isLazy; private transient final boolean isInverse; private transient final Class elementClass; private transient final CacheConcurrencyStrategy cache; private transient final PersistentCollectionType collectionType; private transient final int enableJoinedFetch; private transient final Class ownerClass; private transient final CollectionInitializer loader; private final String role; private final SessionFactoryImplementor factory; private static final Log log = LogFactory.getLog(CollectionPersister.class); public CollectionPersister(Collection collection, DatastoreImpl datastore, String defaultSchema, SessionFactoryImplementor factory) throws MappingException, CacheException { collectionType = collection.getType(); role = collection.getRole(); ownerClass = collection.getOwnerClass(); this.factory = factory; hasOrder = collection.getOrderByString()!=null; sqlOrderByString = collection.getOrderByString(); cache=collection.getCache(); keyType = collection.getKey().getType(); Iterator iter = collection.getKey().getColumnIterator(); int span = collection.getKey().getColumnSpan(); keyColumnNames = new String[span]; int k=0; while ( iter.hasNext() ) { Column col = ( (Column) iter.next() ); keyColumnNames[k] = col.getName(); k++; } isSet = collection.isSet(); isOneToMany = collection.isOneToMany(); primitiveArray = collection.isPrimitiveArray(); array = collection.isArray(); if (isOneToMany) { EntityType type = collection.getOneToMany().getType(); elementType = type; PersistentClass associatedClass = datastore.getPersistentClass( type.getPersistentClass() ); span = associatedClass.getIdentifier().getColumnSpan(); elementColumnNames = new String[span]; iter = associatedClass.getKey().getColumnIterator(); int j=0; while ( iter.hasNext() ) { Column col = (Column) iter.next(); elementColumnNames[j] = col.getName(); j++; } Table table = associatedClass.getTable(); qualifiedTableName = table.getQualifiedName(defaultSchema); enableJoinedFetch = OuterJoinLoader.EAGER; } else { Table table = collection.getTable(); qualifiedTableName = table.getQualifiedName(defaultSchema); elementType = collection.getElement().getType(); span = collection.getElement().getColumnSpan(); elementColumnNames = new String[span]; enableJoinedFetch = collection.getElement().enableJoinedFetch(); iter = collection.getElement().getColumnIterator(); int i= 0; while ( iter.hasNext() ) { Column col = (Column) iter.next(); elementColumnNames[i] = col.getName(); i++; } } unquotedElementColumnNames = StringHelper.unQuote(elementColumnNames); if ( hasIndex = collection.isIndexed() ) { IndexedCollection indexedMap = (IndexedCollection) collection; indexType = indexedMap.getIndex().getType(); int indexSpan = indexedMap.getIndex().getColumnSpan(); iter = indexedMap.getIndex().getColumnIterator(); indexColumnNames = new String[indexSpan]; int i=0; while ( iter.hasNext() ) { Column indexCol = (Column) iter.next(); indexColumnNames[i++] = indexCol.getName(); } rowSelectColumnNames = indexColumnNames; rowSelectType = indexType; unquotedIndexColumnNames = StringHelper.unQuote(indexColumnNames); } else { indexType = null; indexColumnNames = null; unquotedIndexColumnNames = null; rowSelectColumnNames = elementColumnNames; rowSelectType = elementType; } sqlSelectString = sqlSelectString(); sqlDeleteString = sqlDeleteString(); //sqlSelectRowString = sqlSelectRowString(); sqlInsertRowString = sqlInsertRowString(); sqlUpdateRowString = sqlUpdateRowString(); sqlDeleteRowString = sqlDeleteRowString(); isLazy = collection.isLazy(); isInverse = collection.isInverse(); if ( collection.isArray() ) { elementClass = ( (net.sf.hibernate.mapping.Array) collection ).getElementClass(); } else { // for non-arrays, we don't need to know the element class elementClass = null; //elementType.returnedClass(); } loader = createCollectionQuery(factory); } public CollectionInitializer getInitializer() { return loader; } private CollectionInitializer createCollectionQuery(SessionFactoryImplementor factory) throws MappingException { return isOneToMany() ? (CollectionInitializer) new OneToManyLoader(this, factory) : (CollectionInitializer) new CollectionLoader(this, factory); } public void cache(Serializable id, PersistentCollection coll, SessionImplementor s) throws HibernateException { if (cache!=null) cache.put( id, coll.disassemble(this), s.getTimestamp() ); } public PersistentCollection getCachedCollection(Serializable id, SessionImplementor s) throws HibernateException, SQLException { if (cache==null) { return null; } else { Serializable cached = (Serializable) cache.get( id, s.getTimestamp() ); if (cached==null) { return null; } else { PersistentCollection coll = collectionType.wrap(s, cached); coll.assemble(this); return coll; } } } public void softlock(Serializable id) throws CacheException { if (cache!=null) cache.lock(id); } public void releaseSoftlock(Serializable id) throws CacheException { if (cache!=null) cache.release(id); } public String getSQLOrderByString() { return sqlOrderByString; } public String getSQLOrderByString(String alias) { StringTokenizer tokens = new StringTokenizer(sqlOrderByString, ","); StringBuffer result = new StringBuffer(); while ( tokens.hasMoreTokens() ) { result.append(alias).append('.').append( tokens.nextToken().trim() ); if ( tokens.hasMoreTokens() ) result.append(", "); } return result.toString(); } public int enableJoinedFetch() { return enableJoinedFetch; } public boolean hasOrdering() { return hasOrder; } private String getSQLSelectString() { return sqlSelectString; } private String getSQLDeleteString() { return sqlDeleteString; } /*public String getSQLSelectRowString() { return sqlSelectRowString; }*/ private String getSQLInsertRowString() { return sqlInsertRowString; } private String getSQLUpdateRowString() { return sqlUpdateRowString; } private String getSQLDeleteRowString() { return sqlDeleteRowString; } public Type getKeyType() { return keyType; } public Type getIndexType() { return indexType; } public Type getElementType() { return elementType; } public Class getElementClass() { //needed by arrays return elementClass; } public Object readElement(ResultSet rs, Object owner, SessionImplementor session) throws HibernateException, SQLException { Object element = getElementType().nullSafeGet(rs, unquotedElementColumnNames, session, owner); return element; } public Object readIndex(ResultSet rs, SessionImplementor session) throws HibernateException, SQLException { return getIndexType().nullSafeGet(rs, unquotedIndexColumnNames, session, null); } public void writeElement(PreparedStatement st, Object elt, boolean writeOrder, SessionImplementor session) throws HibernateException, SQLException { getElementType().nullSafeSet(st, elt, 1+(writeOrder?0:keyColumnNames.length+(hasIndex?indexColumnNames.length:0)), session); } public void writeIndex(PreparedStatement st, Object idx, boolean writeOrder, SessionImplementor session) throws HibernateException, SQLException { getIndexType().nullSafeSet(st, idx, 1+keyColumnNames.length + (writeOrder?elementColumnNames.length:0), session); } private void writeRowSelect(PreparedStatement st, Object idx, SessionImplementor session) throws HibernateException, SQLException { rowSelectType.nullSafeSet(st, idx, 1+keyColumnNames.length, session); } public void writeKey(PreparedStatement st, Serializable id, boolean writeOrder, SessionImplementor session) throws HibernateException, SQLException { if ( id==null ) throw new NullPointerException("Null Collection Key"); //an assertion getKeyType().nullSafeSet(st, id, 1+(writeOrder?elementColumnNames.length:0), session); } public boolean isPrimitiveArray() { return primitiveArray; } public boolean isArray() { return array; } private String sqlSelectString() { boolean appendIndex = true; StringBuffer buf = new StringBuffer("select "); for ( int i=0; i<elementColumnNames.length; i++ ) { buf.append( elementColumnNames[i] ); if ( i<elementColumnNames.length-1 ) { buf.append(", "); } //Jon Lipsky's patch to allow a Map from id's to objects if ( hasIndex && indexColumnNames.length==1 && ( elementColumnNames[i].equals( indexColumnNames[0] ) ) ) { appendIndex = false; } } if ( hasIndex && appendIndex ) { for (int i=0; i<indexColumnNames.length; i++) { buf.append(", ").append( indexColumnNames[i] ); } } buf.append( " from " ) .append(qualifiedTableName) .append( " where " ) .append( StringHelper.join( " = ? and ", keyColumnNames ) ) .append( " = ?"); if (hasOrder) buf.append(" order by ").append(sqlOrderByString); return buf.toString(); } private String sqlDeleteString() { if (isOneToMany) { StringBuffer buf = new StringBuffer("update ") .append(qualifiedTableName) .append( " set " ) .append( StringHelper.join( " = null, ", keyColumnNames ) ) .append( " = null" ); if ( hasIndex ) { buf.append(", ") .append( StringHelper.join( " = null, ", indexColumnNames ) ) .append( " = null" ); } buf.append( " where " ) .append( StringHelper.join( " = ? and ", keyColumnNames ) ) .append( " = ?" ); return buf.toString(); } else { return new StringBuffer("delete from ") .append(qualifiedTableName) .append(" where ") .append( StringHelper.join( " = ? and ", keyColumnNames ) ) .append(" = ?") .toString(); } } private String sqlInsertRowString() { if (isOneToMany) { StringBuffer buf = new StringBuffer("update ") .append(qualifiedTableName) .append( " set " ) .append( StringHelper.join( " = ?, ", keyColumnNames ) ) .append( " = ?"); if (hasIndex) { buf.append( ", " ) .append( StringHelper.join( " = ?, ", indexColumnNames ) ) .append( " = ?"); } buf.append( " where " ) .append( StringHelper.join( " = ? and ", elementColumnNames ) ) .append( " = ?" ); return buf.toString(); } else { StringBuffer buf = new StringBuffer("insert into ") .append(qualifiedTableName) .append(" ( ") .append( StringHelper.join( ", ", keyColumnNames ) ); if (hasIndex) { buf.append(", ").append( StringHelper.join(", ", indexColumnNames) ); } for ( int i=0; i<elementColumnNames.length; i++) { buf.append( ", " ).append( elementColumnNames[i] ); } buf.append(" ) values ( ?"); buf.append( StringHelper.repeat( ", ?", elementColumnNames.length + keyColumnNames.length - 1 + ( hasIndex ? indexColumnNames.length:0 ) ) ); return buf.append(" )").toString(); } } /*private String sqlSelectRowString() { return ""; //TODO }*/ private String sqlUpdateRowString() { if (isOneToMany) { return null; } else { return new StringBuffer("update ") .append(qualifiedTableName) .append(" set ") .append( StringHelper.join( " = ?, ", elementColumnNames ) ) .append(" = ? where ") .append( StringHelper.join( " = ? and ", keyColumnNames ) ) .append( " = ? and " ) .append( StringHelper.join( " = ? and ", rowSelectColumnNames ) ) .append(" = ?") .toString(); } } private String sqlDeleteRowString() { return new StringBuffer( sqlDeleteString() ) .append(" and ") .append( StringHelper.join( " = ? and ", rowSelectColumnNames ) ) .append(" = ?") .toString(); } public String[] getIndexColumnNames() { return indexColumnNames; } public String[] getElementColumnNames() { return elementColumnNames; } public String[] getKeyColumnNames() { return keyColumnNames; } public boolean isOneToMany() { return isOneToMany; } public boolean hasIndex() { return hasIndex; } public boolean isLazy() { return isLazy; } public boolean isInverse() { return isInverse; } public String getQualifiedTableName() { return qualifiedTableName; } public final void remove(Serializable id, SessionImplementor session) throws SQLException, HibernateException { if ( !isInverse ) { if ( log.isDebugEnabled() ) log.debug("Deleting collection: " + role + "#" + id); // Remove all the old entries PreparedStatement st = session.getBatcher().prepareBatchStatement( getSQLDeleteString() ); try { writeKey(st, id, false, session); session.getBatcher().addToBatch(-1); } catch (SQLException sqle) { JDBCExceptionReporter.logExceptions(sqle); throw sqle; } } } public final void recreate(PersistentCollection collection, Serializable id, SessionImplementor session) throws SQLException, HibernateException { if (!isInverse) { if ( log.isDebugEnabled() ) log.debug("Inserting collection: " + role + "#" + id); //create all the new entries Iterator entries = collection.entries(); if ( entries.hasNext() ) { PreparedStatement st = session.getBatcher().prepareBatchStatement( getSQLInsertRowString() ); int i=0; try { while ( entries.hasNext() ) { Object entry = entries.next(); if ( !isOneToMany || entry!=null ) { writeKey(st, id, false, session); collection.writeTo(st, this, entry, i, false); session.getBatcher().addToBatch(1); } i++; } } catch (SQLException sqle) { JDBCExceptionReporter.logExceptions(sqle); throw sqle; } } } } public final void deleteRows(PersistentCollection collection, Serializable id, SessionImplementor session) throws SQLException, HibernateException { if (!isInverse) { if ( log.isDebugEnabled() ) log.debug("Deleting rows of collection: " + role + "#" + id); //delete all the deleted entries Iterator entries = collection.getDeletes(elementType); if ( entries.hasNext() ) { PreparedStatement st = session.getBatcher().prepareBatchStatement( getSQLDeleteRowString() ); try { while ( entries.hasNext() ) { writeKey(st, id, false, session ); writeRowSelect( st, entries.next(), session ); session.getBatcher().addToBatch(-1); } } catch (SQLException sqle) { JDBCExceptionReporter.logExceptions(sqle); throw sqle; } } } } private final void update(Serializable id, PersistentCollection collection, SessionImplementor session) throws SQLException, HibernateException { PreparedStatement st = null; Iterator entries = collection.entries(); int i=0; try { while ( entries.hasNext() ) { Object entry = entries.next(); if ( collection.needsUpdating(entry, i, elementType) ) { if (st==null) st = session.getBatcher().prepareBatchStatement( getSQLUpdateRowString() ); writeKey(st, id, true, session); collection.writeTo( st, this, entry, i, true ); session.getBatcher().addToBatch(1); } i++; } } catch (SQLException sqle) { JDBCExceptionReporter.logExceptions(sqle); throw sqle; } } private final void updateOneToMany(Serializable id, PersistentCollection collection, SessionImplementor session) throws SQLException, HibernateException { PreparedStatement rmvst = null; int i=0; Iterator entries = collection.entries(); try { while ( entries.hasNext() ) { Object entry = entries.next(); if ( collection.needsUpdating(entry, i, elementType) ) { // will still be issued when it used to be null if (rmvst==null) rmvst = session.getBatcher().prepareBatchStatement( getSQLDeleteRowString() ); writeKey(rmvst, id, false, session); writeIndex(rmvst, collection.getIndex(entry, i), false, session); session.getBatcher().addToBatch(-1); } i++; } } catch (SQLException sqle) { JDBCExceptionReporter.logExceptions(sqle); throw sqle; } // finish all the "removes" first to take care of possible unique constraints // and so that we can take advantage of batching PreparedStatement insst = null; i=0; entries = collection.entries(); try { while ( entries.hasNext() ) { Object entry = entries.next(); if ( entry!=null || collection.needsUpdating(entry, i, elementType) ) { if (insst==null) insst = session.getBatcher().prepareBatchStatement( getSQLInsertRowString() ); writeKey(insst, id, false, session); collection.writeTo(insst, this, entry, i, false); session.getBatcher().addToBatch(1); } i++; } } catch (SQLException sqle) { JDBCExceptionReporter.logExceptions(sqle); throw sqle; } } public final void updateRows(PersistentCollection collection, Serializable id, SessionImplementor session) throws SQLException, HibernateException { if (!isInverse) { if ( log.isDebugEnabled() ) log.debug("Updating rows of collection: " + role + "#" + id); //update all the modified entries if (isOneToMany) { updateOneToMany(id, collection, session); } else { update(id, collection, session); } } } public final void insertRows(PersistentCollection collection, Serializable id, SessionImplementor session) throws SQLException, HibernateException { if (!isInverse) { if ( log.isDebugEnabled() ) log.debug("Inserting rows of collection: " + role + "#" + id); //insert all the new entries Iterator entries = collection.entries(); PreparedStatement st = null; int i=0; try { while ( entries.hasNext() ) { Object entry = entries.next(); if ( collection.needsInserting(entry, i, elementType) && ( !isOneToMany || entry!=null ) ) { if (st==null) st = session.getBatcher().prepareBatchStatement( getSQLInsertRowString() ); writeKey(st, id, false, session); collection.writeTo( st, this, entry, i, false ); session.getBatcher().addToBatch(1); } i++; } } catch (SQLException sqle) { JDBCExceptionReporter.logExceptions(sqle); throw sqle; } } } public String getRole() { return role; } Object readResolve() throws ObjectStreamException { try { return factory.getCollectionPersister(role); } catch (MappingException me) { throw new InvalidObjectException( me.getMessage() ); } } public boolean isSet() { return isSet; } public Class getOwnerClass() { return ownerClass; } } Index: ArrayHolder.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/ArrayHolder.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ArrayHolder.java 1 Jan 2003 13:53:55 -0000 1.1.1.1 --- ArrayHolder.java 3 Jan 2003 13:36:00 -0000 1.2 *************** *** 17,21 **** import net.sf.hibernate.type.*; import net.sf.hibernate.engine.SessionImplementor; - import net.sf.hibernate.impl.CollectionPersister; /** --- 17,20 ---- *************** *** 114,123 **** * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) */ ! public Object readFrom(ResultSet rs, CollectionPersister persister) throws HibernateException, SQLException { // relys on the fact that elements are returned sorted by index! ! Object element = persister.readElement( rs, session); int index = ( (Integer) persister.readIndex(rs, session) ).intValue(); for ( int i = temp.size(); i<=index; i++) { --- 113,122 ---- * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) */ ! public Object readFrom(ResultSet rs, CollectionPersister persister, Object owner) throws HibernateException, SQLException { // relys on the fact that elements are returned sorted by index! ! Object element = persister.readElement(rs, owner, session); int index = ( (Integer) persister.readIndex(rs, session) ).intValue(); for ( int i = temp.size(); i<=index; i++) { Index: Bag.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Bag.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Bag.java 1 Jan 2003 13:53:58 -0000 1.1.1.1 --- Bag.java 3 Jan 2003 13:36:00 -0000 1.2 *************** *** 18,22 **** import net.sf.hibernate.HibernateException; import net.sf.hibernate.engine.SessionImplementor; - import net.sf.hibernate.impl.CollectionPersister; import net.sf.hibernate.type.Type; --- 18,21 ---- *************** *** 85,90 **** * @see net.sf.hibernate.collections.PersistentCollection#readFrom(ResultSet, CollectionPersister) */ ! public Object readFrom(ResultSet rs, CollectionPersister persister) throws HibernateException, SQLException { ! Object element = persister.readElement(rs, session) ; bag.add(element); return element; --- 84,89 ---- * @see net.sf.hibernate.collections.PersistentCollection#readFrom(ResultSet, CollectionPersister) */ ! public Object readFrom(ResultSet rs, CollectionPersister persister, Object owner) throws HibernateException, SQLException { ! Object element = persister.readElement(rs, owner, session) ; bag.add(element); return element; Index: List.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/List.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** List.java 1 Jan 2003 13:53:59 -0000 1.1.1.1 --- List.java 3 Jan 2003 13:36:00 -0000 1.2 *************** *** 17,21 **** import net.sf.hibernate.HibernateException; import net.sf.hibernate.engine.SessionImplementor; - import net.sf.hibernate.impl.CollectionPersister; import net.sf.hibernate.type.Type; --- 17,20 ---- *************** *** 294,299 **** * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) */ ! public Object readFrom(ResultSet rs, CollectionPersister persister) throws HibernateException, SQLException { ! Object element = persister.readElement(rs, session) ; int index = ( (Integer) persister.readIndex(rs, session) ).intValue(); for ( int i = list.size(); i<=index; i++) { --- 293,298 ---- * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) */ ! public Object readFrom(ResultSet rs, CollectionPersister persister, Object owner) throws HibernateException, SQLException { ! Object element = persister.readElement(rs, owner, session) ; int index = ( (Integer) persister.readIndex(rs, session) ).intValue(); for ( int i = list.size(); i<=index; i++) { Index: Map.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Map.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Map.java 1 Jan 2003 13:54:02 -0000 1.1.1.1 --- Map.java 3 Jan 2003 13:36:00 -0000 1.2 *************** *** 16,20 **** import net.sf.hibernate.engine.SessionImplementor; import net.sf.hibernate.util.LinkedHashCollectionHelper; - import net.sf.hibernate.impl.CollectionPersister; import net.sf.hibernate.type.Type; --- 16,19 ---- *************** *** 201,206 **** * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) */ ! public Object readFrom(ResultSet rs, CollectionPersister persister) throws HibernateException, SQLException { ! Object element = persister.readElement(rs, session); Object index = persister.readIndex(rs, session); map.put(index, element); --- 200,205 ---- * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) */ ! public Object readFrom(ResultSet rs, CollectionPersister persister, Object owner) throws HibernateException, SQLException { ! Object element = persister.readElement(rs, owner, session); Object index = persister.readIndex(rs, session); map.put(index, element); Index: PersistentCollection.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/PersistentCollection.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PersistentCollection.java 1 Jan 2003 13:54:05 -0000 1.1.1.1 --- PersistentCollection.java 3 Jan 2003 13:36:00 -0000 1.2 *************** *** 3,7 **** import net.sf.hibernate.type.Type; - import net.sf.hibernate.impl.CollectionPersister; import java.util.ArrayList; --- 3,6 ---- *************** *** 155,159 **** public abstract Iterator entries(); public abstract void readEntries(Iterator entries); ! public abstract Object readFrom(ResultSet rs, CollectionPersister role) throws HibernateException, SQLException; public abstract void writeTo(PreparedStatement st, CollectionPersister role, Object entry, int i, boolean writeOrder) throws HibernateException, SQLException; --- 154,158 ---- public abstract Iterator entries(); public abstract void readEntries(Iterator entries); ! public abstract Object readFrom(ResultSet rs, CollectionPersister role, Object owner) throws HibernateException, SQLException; public abstract void writeTo(PreparedStatement st, CollectionPersister role, Object entry, int i, boolean writeOrder) throws HibernateException, SQLException; Index: Set.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Set.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Set.java 1 Jan 2003 13:54:07 -0000 1.1.1.1 --- Set.java 3 Jan 2003 13:36:00 -0000 1.2 *************** *** 17,21 **** import net.sf.hibernate.engine.SessionImplementor; import net.sf.hibernate.util.LinkedHashCollectionHelper; - import net.sf.hibernate.impl.CollectionPersister; import net.sf.hibernate.type.Type; --- 17,20 ---- *************** *** 225,230 **** * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) */ ! public Object readFrom(ResultSet rs, CollectionPersister persister) throws HibernateException, SQLException { ! Object element = persister.readElement(rs, session); set.add(element); return element; --- 224,229 ---- * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) */ ! public Object readFrom(ResultSet rs, CollectionPersister persister, Object owner) throws HibernateException, SQLException { ! Object element = persister.readElement(rs, owner, session); set.add(element); return element; Index: SortedMap.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/SortedMap.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SortedMap.java 1 Jan 2003 13:54:08 -0000 1.1.1.1 --- SortedMap.java 3 Jan 2003 13:36:00 -0000 1.2 *************** *** 11,15 **** import net.sf.hibernate.HibernateException; import net.sf.hibernate.engine.SessionImplementor; - import net.sf.hibernate.impl.CollectionPersister; --- 11,14 ---- Index: SortedSet.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/SortedSet.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SortedSet.java 1 Jan 2003 13:54:08 -0000 1.1.1.1 --- SortedSet.java 3 Jan 2003 13:36:00 -0000 1.2 *************** *** 9,13 **** import net.sf.hibernate.HibernateException; import net.sf.hibernate.engine.SessionImplementor; - import net.sf.hibernate.impl.CollectionPersister; --- 9,12 ---- |