From: <one...@us...> - 2003-01-04 11:16:00
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection In directory sc8-pr-cvs1:/tmp/cvs-serv14211/src/net/sf/hibernate/collection Modified Files: ArrayHolder.java Bag.java CollectionPersister.java List.java Map.java ODMGCollection.java PersistentCollection.java Set.java SortedMap.java SortedSet.java Log Message: reformatted code with beautiful, shiny, happy TABS! improved an exception Index: ArrayHolder.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/ArrayHolder.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ArrayHolder.java 3 Jan 2003 13:36:00 -0000 1.2 --- ArrayHolder.java 4 Jan 2003 11:15:27 -0000 1.3 *************** *** 18,22 **** import net.sf.hibernate.engine.SessionImplementor; ! /** * A persistent wrapper for an array. Lazy initialization * is NOT supported. --- 18,22 ---- import net.sf.hibernate.engine.SessionImplementor; ! /** * A persistent wrapper for an array. Lazy initialization * is NOT supported. *************** *** 57,61 **** super(session); elementClass = persister.getElementClass(); ! } public Object getArray() { return array; --- 57,61 ---- super(session); elementClass = persister.getElementClass(); ! } public Object getArray() { return array; *************** *** 70,74 **** return true; } ! /** * @see PersistentCollection#replaceElements(Map) --- 70,74 ---- return true; } ! /** * @see PersistentCollection#replaceElements(Map) *************** *** 80,87 **** Object r; if ( val!=null && ( r=replacements.get(val) )!=null ) ! Array.set(array, i, r); } } ! /** * @see PersistentCollection#elements() --- 80,87 ---- Object r; if ( val!=null && ( r=replacements.get(val) )!=null ) ! Array.set(array, i, r); } } ! /** * @see PersistentCollection#elements() *************** *** 99,118 **** return false; } ! /** * @see PersistentCollection#writeTo(PreparedStatement, CollectionPersister, Object, int) */ public void writeTo(PreparedStatement st, CollectionPersister persister, Object entry, int i, boolean writeOrder) ! throws HibernateException, SQLException { ! persister.writeElement(st, entry, writeOrder, session); persister.writeIndex(st, new Integer(i), writeOrder, session); } ! /** * @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! --- 99,118 ---- return false; } ! /** * @see PersistentCollection#writeTo(PreparedStatement, CollectionPersister, Object, int) */ public void writeTo(PreparedStatement st, CollectionPersister persister, Object entry, int i, boolean writeOrder) ! throws HibernateException, SQLException { ! persister.writeElement(st, entry, writeOrder, session); persister.writeIndex(st, new Integer(i), writeOrder, session); } ! /** * @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! *************** *** 126,130 **** return element; } ! /** * @see PersistentCollection#entries() --- 126,130 ---- return element; } ! /** * @see PersistentCollection#entries() *************** *** 148,154 **** //Arrays have to do things a bit differently. ! public Object getInitialValue(boolean lazy) throws SQLException, HibernateException { ! temp = new ArrayList(); super.getInitialValue(false); --- 148,154 ---- //Arrays have to do things a bit differently. ! public Object getInitialValue(boolean lazy) throws SQLException, HibernateException { ! temp = new ArrayList(); super.getInitialValue(false); *************** *** 157,166 **** Array.set(array, i, temp.get(i) ); } ! session.addArrayHolder(this); temp=null; return array; } ! public void beforeInitialize(CollectionPersister persister) { //if (temp==null) throw new UnsupportedOperationException("Can't lazily initialize arrays"); --- 157,166 ---- Array.set(array, i, temp.get(i) ); } ! session.addArrayHolder(this); temp=null; return array; } ! public void beforeInitialize(CollectionPersister persister) { //if (temp==null) throw new UnsupportedOperationException("Can't lazily initialize arrays"); *************** *** 170,177 **** return true; } ! ! public void assemble(CollectionPersister persister) ! throws HibernateException, SQLException { Object[] cached = (Object[]) array; --- 170,177 ---- return true; } ! ! public void assemble(CollectionPersister persister) ! throws HibernateException, SQLException { Object[] cached = (Object[]) array; *************** *** 182,186 **** Array.set(array, i, persister.getElementType().assemble( (Serializable) cached[i], session, null) ); } ! } --- 182,186 ---- Array.set(array, i, persister.getElementType().assemble( (Serializable) cached[i], session, null) ); } ! } *************** *** 193,204 **** } return result; ! } ! public Object getCachedValue() { session.addArrayHolder(this); return array; } ! public Iterator getDeletes(Type elemType) throws HibernateException { java.util.Set deletes = new HashSet(); --- 193,204 ---- } return result; ! } ! public Object getCachedValue() { session.addArrayHolder(this); return array; } ! public Iterator getDeletes(Type elemType) throws HibernateException { java.util.Set deletes = new HashSet(); *************** *** 209,217 **** return deletes.iterator(); } ! public boolean needsInserting(Object entry, int i, Type elemType) throws HibernateException { return i >= Array.getLength(getSnapshot()); } ! public boolean needsUpdating(Object entry, int i, Type elemType) throws HibernateException { Serializable snapshot = getSnapshot(); --- 209,217 ---- return deletes.iterator(); } ! public boolean needsInserting(Object entry, int i, Type elemType) throws HibernateException { return i >= Array.getLength(getSnapshot()); } ! public boolean needsUpdating(Object entry, int i, Type elemType) throws HibernateException { Serializable snapshot = getSnapshot(); *************** *** 224,228 **** return new Integer(i); } ! } --- 224,231 ---- return new Integer(i); } ! } + + + Index: Bag.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Bag.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Bag.java 3 Jan 2003 14:07:30 -0000 1.3 --- Bag.java 4 Jan 2003 11:15:27 -0000 1.4 *************** *** 24,28 **** private java.util.List bag; ! public Bag(SessionImplementor session) { super(session); --- 24,28 ---- private java.util.List bag; ! public Bag(SessionImplementor session) { super(session); *************** *** 43,47 **** initialized = true; } ! /** * @see net.sf.hibernate.collections.PersistentCollection#elements() --- 43,47 ---- initialized = true; } ! /** * @see net.sf.hibernate.collections.PersistentCollection#elements() *************** *** 53,57 **** return bag.isEmpty(); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#replaceElements(Map) --- 53,57 ---- return bag.isEmpty(); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#replaceElements(Map) *************** *** 64,68 **** } } ! /** * @see net.sf.hibernate.collections.PersistentCollection#entries() --- 64,68 ---- } } ! /** * @see net.sf.hibernate.collections.PersistentCollection#entries() *************** *** 71,75 **** return bag.iterator(); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#readEntries(Iterator) --- 71,75 ---- return bag.iterator(); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#readEntries(Iterator) *************** *** 80,84 **** } } ! /** * @see net.sf.hibernate.collections.PersistentCollection#readFrom(ResultSet, CollectionPersister) --- 80,84 ---- } } ! /** * @see net.sf.hibernate.collections.PersistentCollection#readFrom(ResultSet, CollectionPersister) *************** *** 89,101 **** return element; } ! /** * @see net.sf.hibernate.collections.PersistentCollection#writeTo(PreparedStatement, CollectionPersister, Object, int, boolean) */ public void writeTo(PreparedStatement st, CollectionPersister persister, Object entry, int i, boolean writeOrder) ! throws HibernateException, SQLException { persister.writeElement(st, entry, writeOrder, session); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#beforeInitialize() --- 89,101 ---- return element; } ! /** * @see net.sf.hibernate.collections.PersistentCollection#writeTo(PreparedStatement, CollectionPersister, Object, int, boolean) */ public void writeTo(PreparedStatement st, CollectionPersister persister, Object entry, int i, boolean writeOrder) ! throws HibernateException, SQLException { persister.writeElement(st, entry, writeOrder, session); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#beforeInitialize() *************** *** 104,108 **** this.bag = new ArrayList(); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#equalsSnapshot(Serializable, Type) --- 104,108 ---- this.bag = new ArrayList(); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#equalsSnapshot(Serializable, Type) *************** *** 127,137 **** return result; } ! ! /** * @see net.sf.hibernate.collections.PersistentCollection#snapshot(CollectionPersister, SessionImplementor) */ protected Serializable snapshot(CollectionPersister persister) ! throws HibernateException { ArrayList clonedList = new ArrayList( bag.size() ); Iterator iter = bag.iterator(); --- 127,137 ---- return result; } ! ! /** * @see net.sf.hibernate.collections.PersistentCollection#snapshot(CollectionPersister, SessionImplementor) */ protected Serializable snapshot(CollectionPersister persister) ! throws HibernateException { ArrayList clonedList = new ArrayList( bag.size() ); Iterator iter = bag.iterator(); *************** *** 141,151 **** return clonedList; } ! /** * @see net.sf.hibernate.collections.PersistentCollection#disassemble(CollectionPersister, SessionImplementor) */ public Serializable disassemble(CollectionPersister persister) ! throws HibernateException { ! int length = bag.size(); ArrayList result = new ArrayList(length); --- 141,151 ---- return clonedList; } ! /** * @see net.sf.hibernate.collections.PersistentCollection#disassemble(CollectionPersister, SessionImplementor) */ public Serializable disassemble(CollectionPersister persister) ! throws HibernateException { ! int length = bag.size(); ArrayList result = new ArrayList(length); *************** *** 155,164 **** return result; } ! /** * @see net.sf.hibernate.collections.PersistentCollection#assemble(CollectionPersister, SessionImplementor) */ public void assemble(CollectionPersister persister) ! throws HibernateException, SQLException { int length = bag.size(); java.util.List old = bag; --- 155,164 ---- return result; } ! /** * @see net.sf.hibernate.collections.PersistentCollection#assemble(CollectionPersister, SessionImplementor) */ public void assemble(CollectionPersister persister) ! throws HibernateException, SQLException { int length = bag.size(); java.util.List old = bag; *************** *** 168,189 **** } } ! public boolean needsRecreate(Type elemType) throws HibernateException { return true; } ! ! public Iterator getDeletes(Type elemType) throws HibernateException { throw new AssertionFailure("Not implemented for Bags"); } ! public boolean needsInserting(Object entry, int i, Type elemType) throws HibernateException { throw new AssertionFailure("Not implemented for Bags"); } ! public boolean needsUpdating(Object entry, int i, Type elemType) throws HibernateException { throw new AssertionFailure("Not implemented for Bags"); } ! /** * @see java.util.Collection#size() --- 168,189 ---- } } ! public boolean needsRecreate(Type elemType) throws HibernateException { return true; } ! ! public Iterator getDeletes(Type elemType) throws HibernateException { throw new AssertionFailure("Not implemented for Bags"); } ! public boolean needsInserting(Object entry, int i, Type elemType) throws HibernateException { throw new AssertionFailure("Not implemented for Bags"); } ! public boolean needsUpdating(Object entry, int i, Type elemType) throws HibernateException { throw new AssertionFailure("Not implemented for Bags"); } ! /** * @see java.util.Collection#size() *************** *** 193,197 **** return bag.size(); } ! /** * @see java.util.Collection#isEmpty() --- 193,197 ---- return bag.size(); } ! /** * @see java.util.Collection#isEmpty() *************** *** 201,205 **** return bag.isEmpty(); } ! /** * @see java.util.Collection#contains(Object) --- 201,205 ---- return bag.isEmpty(); } ! /** * @see java.util.Collection#contains(Object) *************** *** 209,213 **** return bag.contains(o); } ! /** * @see java.util.Collection#iterator() --- 209,213 ---- return bag.contains(o); } ! /** * @see java.util.Collection#iterator() *************** *** 217,221 **** return new IteratorProxy( bag.iterator() ); } ! /** * @see java.util.Collection#toArray() --- 217,221 ---- return new IteratorProxy( bag.iterator() ); } ! /** * @see java.util.Collection#toArray() *************** *** 225,229 **** return bag.toArray(); } ! /** * @see java.util.Collection#toArray(Object[]) --- 225,229 ---- return bag.toArray(); } ! /** * @see java.util.Collection#toArray(Object[]) *************** *** 233,237 **** return bag.toArray(a); } ! /** * @see java.util.Collection#add(Object) --- 233,237 ---- return bag.toArray(a); } ! /** * @see java.util.Collection#add(Object) *************** *** 246,250 **** } } ! /** * @see java.util.Collection#remove(Object) --- 246,250 ---- } } ! /** * @see java.util.Collection#remove(Object) *************** *** 254,258 **** return bag.remove(o); } ! /** * @see java.util.Collection#containsAll(Collection) --- 254,258 ---- return bag.remove(o); } ! /** * @see java.util.Collection#containsAll(Collection) *************** *** 262,266 **** return bag.containsAll(c); } ! /** * @see java.util.Collection#addAll(Collection) --- 262,266 ---- return bag.containsAll(c); } ! /** * @see java.util.Collection#addAll(Collection) *************** *** 275,279 **** } } ! /** * @see java.util.Collection#removeAll(Collection) --- 275,279 ---- } } ! /** * @see java.util.Collection#removeAll(Collection) *************** *** 283,287 **** return bag.removeAll(c); } ! /** * @see java.util.Collection#retainAll(Collection) --- 283,287 ---- return bag.removeAll(c); } ! /** * @see java.util.Collection#retainAll(Collection) *************** *** 291,295 **** return bag.retainAll(c); } ! /** * @see java.util.Collection#clear() --- 291,295 ---- return bag.retainAll(c); } ! /** * @see java.util.Collection#clear() *************** *** 299,303 **** bag.clear(); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#getIndex(Object, int) --- 299,303 ---- bag.clear(); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#getIndex(Object, int) *************** *** 308,313 **** public Bag() {} ! ! public DBag difference(DBag arg0) { //TODO: perhaps not correct semantics - is it supposed to be symmetric? --- 308,313 ---- public Bag() {} ! ! public DBag difference(DBag arg0) { //TODO: perhaps not correct semantics - is it supposed to be symmetric? *************** *** 318,322 **** return new Bag(session, list); } ! public DBag intersection(DBag bag) { read(); --- 318,322 ---- return new Bag(session, list); } ! public DBag intersection(DBag bag) { read(); *************** *** 326,330 **** return new Bag(session, list); } ! public int occurrences(Object o) { read(); --- 326,330 ---- return new Bag(session, list); } ! public int occurrences(Object o) { read(); *************** *** 336,340 **** return result; } ! public DBag union(DBag bag) { read(); --- 336,340 ---- return result; } ! public DBag union(DBag bag) { read(); *************** *** 344,348 **** return new Bag(session, list); } ! /*public boolean add(Object o, int n) { if (n>0) write(); --- 344,348 ---- return new Bag(session, list); } ! /*public boolean add(Object o, int n) { if (n>0) write(); *************** *** 360,364 **** return n>0; } ! public Set uniqueSet() { Set set = new HashSet( bag.size() ); --- 360,364 ---- return n>0; } ! public Set uniqueSet() { Set set = new HashSet( bag.size() ); *************** *** 384,388 **** // List OPERATIONS: ! /** * @see java.util.List#add(int, Object) --- 384,388 ---- // List OPERATIONS: ! /** * @see java.util.List#add(int, Object) *************** *** 392,396 **** bag.add(i, o); } ! /** * @see java.util.List#addAll(int, Collection) --- 392,396 ---- bag.add(i, o); } ! /** * @see java.util.List#addAll(int, Collection) *************** *** 400,404 **** return bag.addAll(i, c); } ! /** * @see java.util.List#get(int) --- 400,404 ---- return bag.addAll(i, c); } ! /** * @see java.util.List#get(int) *************** *** 408,412 **** return bag.get(i); } ! /** * @see java.util.List#indexOf(Object) --- 408,412 ---- return bag.get(i); } ! /** * @see java.util.List#indexOf(Object) *************** *** 416,420 **** return bag.indexOf(o); } ! /** * @see java.util.List#lastIndexOf(Object) --- 416,420 ---- return bag.indexOf(o); } ! /** * @see java.util.List#lastIndexOf(Object) *************** *** 424,428 **** return bag.lastIndexOf(o); } ! /** * @see java.util.List#listIterator() --- 424,428 ---- return bag.lastIndexOf(o); } ! /** * @see java.util.List#listIterator() *************** *** 432,436 **** return new ListIteratorProxy( bag.listIterator() ); } ! /** * @see java.util.List#listIterator(int) --- 432,436 ---- return new ListIteratorProxy( bag.listIterator() ); } ! /** * @see java.util.List#listIterator(int) *************** *** 440,444 **** return new ListIteratorProxy( bag.listIterator(i) ); } ! /** * @see java.util.List#remove(int) --- 440,444 ---- return new ListIteratorProxy( bag.listIterator(i) ); } ! /** * @see java.util.List#remove(int) *************** *** 448,452 **** return bag.remove(i); } ! /** * @see java.util.List#set(int, Object) --- 448,452 ---- return bag.remove(i); } ! /** * @see java.util.List#set(int, Object) *************** *** 456,460 **** return bag.set(i, o); } ! /** * @see java.util.List#subList(int, int) --- 456,460 ---- return bag.set(i, o); } ! /** * @see java.util.List#subList(int, int) *************** *** 464,473 **** return new ListProxy( bag.subList(start, end) ); } ! public String toString() { read(); return bag.toString(); } ! /*public boolean equals(Object other) { read(); --- 464,473 ---- return new ListProxy( bag.subList(start, end) ); } ! public String toString() { read(); return bag.toString(); } ! /*public boolean equals(Object other) { read(); *************** *** 479,482 **** return bag.hashCode(); }*/ ! } --- 479,485 ---- return bag.hashCode(); }*/ ! } + + + Index: CollectionPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/CollectionPersister.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CollectionPersister.java 3 Jan 2003 13:36:00 -0000 1.1 --- CollectionPersister.java 4 Jan 2003 11:15:27 -0000 1.2 *************** *** 37,44 **** 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 */ --- 37,44 ---- 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 */ *************** *** 84,88 **** private static final Log log = LogFactory.getLog(CollectionPersister.class); ! public CollectionPersister(Collection collection, DatastoreImpl datastore, String defaultSchema, SessionFactoryImplementor factory) throws MappingException, CacheException { --- 84,88 ---- private static final Log log = LogFactory.getLog(CollectionPersister.class); ! public CollectionPersister(Collection collection, DatastoreImpl datastore, String defaultSchema, SessionFactoryImplementor factory) throws MappingException, CacheException { *************** *** 145,152 **** elementColumnNames[i] = col.getName(); i++; ! } } unquotedElementColumnNames = StringHelper.unQuote(elementColumnNames); ! if ( hasIndex = collection.isIndexed() ) { --- 145,152 ---- elementColumnNames[i] = col.getName(); i++; ! } } unquotedElementColumnNames = StringHelper.unQuote(elementColumnNames); ! if ( hasIndex = collection.isIndexed() ) { *************** *** 192,209 **** 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() ); --- 192,209 ---- 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() ); *************** *** 237,241 **** return sqlOrderByString; } ! public String getSQLOrderByString(String alias) { StringTokenizer tokens = new StringTokenizer(sqlOrderByString, ","); --- 237,241 ---- return sqlOrderByString; } ! public String getSQLOrderByString(String alias) { StringTokenizer tokens = new StringTokenizer(sqlOrderByString, ","); *************** *** 251,255 **** return enableJoinedFetch; } ! public boolean hasOrdering() { return hasOrder; --- 251,255 ---- return enableJoinedFetch; } ! public boolean hasOrdering() { return hasOrder; *************** *** 279,291 **** return sqlDeleteRowString; } ! public Type getKeyType() { return keyType; } ! public Type getIndexType() { return indexType; } ! public Type getElementType() { return elementType; --- 279,291 ---- return sqlDeleteRowString; } ! public Type getKeyType() { return keyType; } ! public Type getIndexType() { return indexType; } ! public Type getElementType() { return elementType; *************** *** 304,326 **** } ! 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); } --- 304,326 ---- } ! 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); } *************** *** 344,348 **** if ( hasIndex && indexColumnNames.length==1 && ( elementColumnNames[i].equals( indexColumnNames[0] ) ) ) { appendIndex = false; ! } } if ( hasIndex && appendIndex ) { --- 344,348 ---- if ( hasIndex && indexColumnNames.length==1 && ( elementColumnNames[i].equals( indexColumnNames[0] ) ) ) { appendIndex = false; ! } } if ( hasIndex && appendIndex ) { *************** *** 352,359 **** } buf.append( " from " ) ! .append(qualifiedTableName) ! .append( " where " ) ! .append( StringHelper.join( " = ? and ", keyColumnNames ) ) ! .append( " = ?"); if (hasOrder) buf.append(" order by ").append(sqlOrderByString); return buf.toString(); --- 352,359 ---- } buf.append( " from " ) ! .append(qualifiedTableName) ! .append( " where " ) ! .append( StringHelper.join( " = ? and ", keyColumnNames ) ) ! .append( " = ?"); if (hasOrder) buf.append(" order by ").append(sqlOrderByString); return buf.toString(); *************** *** 363,387 **** 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(); } } --- 363,387 ---- 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(); } } *************** *** 390,412 **** 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) ); --- 390,412 ---- 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) ); *************** *** 417,431 **** 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) { --- 417,431 ---- 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) { *************** *** 434,470 **** 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; --- 434,470 ---- 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; *************** *** 480,488 **** return isInverse; } ! public String getQualifiedTableName() { return qualifiedTableName; } ! public final void remove(Serializable id, SessionImplementor session) throws SQLException, HibernateException { --- 480,488 ---- return isInverse; } ! public String getQualifiedTableName() { return qualifiedTableName; } ! public final void remove(Serializable id, SessionImplementor session) throws SQLException, HibernateException { *************** *** 492,496 **** // Remove all the old entries ! PreparedStatement st = session.getBatcher().prepareBatchStatement( getSQLDeleteString() ); --- 492,496 ---- // Remove all the old entries ! PreparedStatement st = session.getBatcher().prepareBatchStatement( getSQLDeleteString() ); *************** *** 503,513 **** throw sqle; } ! } } ! public final void recreate(PersistentCollection collection, Serializable id, SessionImplementor session) ! throws SQLException, HibernateException { if (!isInverse) { --- 503,513 ---- throw sqle; } ! } } ! public final void recreate(PersistentCollection collection, Serializable id, SessionImplementor session) ! throws SQLException, HibernateException { if (!isInverse) { *************** *** 541,546 **** } ! public final void deleteRows(PersistentCollection collection, Serializable id, SessionImplementor session) ! throws SQLException, HibernateException { if (!isInverse) { --- 541,546 ---- } ! public final void deleteRows(PersistentCollection collection, Serializable id, SessionImplementor session) ! throws SQLException, HibernateException { if (!isInverse) { *************** *** 551,555 **** Iterator entries = collection.getDeletes(elementType); if ( entries.hasNext() ) { ! PreparedStatement st = session.getBatcher().prepareBatchStatement( getSQLDeleteRowString() ); --- 551,555 ---- Iterator entries = collection.getDeletes(elementType); if ( entries.hasNext() ) { ! PreparedStatement st = session.getBatcher().prepareBatchStatement( getSQLDeleteRowString() ); *************** *** 570,574 **** private final void update(Serializable id, PersistentCollection collection, SessionImplementor session) throws SQLException, HibernateException { ! PreparedStatement st = null; Iterator entries = collection.entries(); --- 570,574 ---- private final void update(Serializable id, PersistentCollection collection, SessionImplementor session) throws SQLException, HibernateException { ! PreparedStatement st = null; Iterator entries = collection.entries(); *************** *** 591,595 **** } } ! private final void updateOneToMany(Serializable id, PersistentCollection collection, SessionImplementor session) throws SQLException, HibernateException { --- 591,595 ---- } } ! private final void updateOneToMany(Serializable id, PersistentCollection collection, SessionImplementor session) throws SQLException, HibernateException { *************** *** 635,639 **** } } ! public final void updateRows(PersistentCollection collection, Serializable id, SessionImplementor session) throws SQLException, HibernateException { --- 635,639 ---- } } ! public final void updateRows(PersistentCollection collection, Serializable id, SessionImplementor session) throws SQLException, HibernateException { *************** *** 641,645 **** if ( log.isDebugEnabled() ) log.debug("Updating rows of collection: " + role + "#" + id); ! //update all the modified entries if (isOneToMany) { --- 641,645 ---- if ( log.isDebugEnabled() ) log.debug("Updating rows of collection: " + role + "#" + id); ! //update all the modified entries if (isOneToMany) { *************** *** 651,658 **** } } ! ! public final void insertRows(PersistentCollection collection, Serializable id, SessionImplementor session) ! throws SQLException, HibernateException { ! if (!isInverse) { --- 651,658 ---- } } ! ! public final void insertRows(PersistentCollection collection, Serializable id, SessionImplementor session) ! throws SQLException, HibernateException { ! if (!isInverse) { *************** *** 681,690 **** } } ! ! public String getRole() { return role; } ! Object readResolve() throws ObjectStreamException { try { --- 681,690 ---- } } ! ! public String getRole() { return role; } ! Object readResolve() throws ObjectStreamException { try { *************** *** 695,699 **** } } ! public boolean isSet() { return isSet; --- 695,699 ---- } } ! public boolean isSet() { return isSet; *************** *** 703,707 **** return ownerClass; } ! } --- 703,710 ---- return ownerClass; } ! } + + + Index: List.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/List.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** List.java 3 Jan 2003 14:07:30 -0000 1.3 --- List.java 4 Jan 2003 11:15:27 -0000 1.4 *************** *** 20,28 **** ! /** * A persistent wrapper for a java.util.List */ public class List extends ODMGCollection implements java.util.List, DList, DArray { ! private java.util.List list; --- 20,28 ---- ! /** * A persistent wrapper for a java.util.List */ public class List extends ODMGCollection implements java.util.List, DList, DArray { ! private java.util.List list; *************** *** 45,49 **** } return true; ! } public List(SessionImplementor session) { --- 45,49 ---- } return true; ! } public List(SessionImplementor session) { *************** *** 67,71 **** return list.size(); } ! /** * @see List#isEmpty() --- 67,71 ---- return list.size(); } ! /** * @see List#isEmpty() *************** *** 75,79 **** return list.isEmpty(); } ! /** * @see List#contains(Object) --- 75,79 ---- return list.isEmpty(); } ! /** * @see List#contains(Object) *************** *** 83,87 **** return list.contains(object); } ! /** * @see List#iterator() --- 83,87 ---- return list.contains(object); } ! /** * @see List#iterator() *************** *** 91,95 **** return new IteratorProxy( list.iterator() ); } ! /** * @see List#toArray() --- 91,95 ---- return new IteratorProxy( list.iterator() ); } ! /** * @see List#toArray() *************** *** 99,103 **** return list.toArray(); } ! /** * @see List#toArray(Object[]) --- 99,103 ---- return list.toArray(); } ! /** * @see List#toArray(Object[]) *************** *** 107,111 **** return list.toArray(array); } ! /** * @see List#add(Object) --- 107,111 ---- return list.toArray(array); } ! /** * @see List#add(Object) *************** *** 120,124 **** } } ! /** * @see List#remove(Object) --- 120,124 ---- } } ! /** * @see List#remove(Object) *************** *** 128,132 **** return list.remove(arg0); } ! /** * @see List#containsAll(Collection) --- 128,132 ---- return list.remove(arg0); } ! /** * @see List#containsAll(Collection) *************** *** 136,140 **** return list.containsAll( arg0); } ! /** * @see List#addAll(Collection) --- 136,140 ---- return list.containsAll( arg0); } ! /** * @see List#addAll(Collection) *************** *** 149,153 **** } } ! /** * @see List#addAll(int, Collection) --- 149,153 ---- } } ! /** * @see List#addAll(int, Collection) *************** *** 157,161 **** return list.addAll( arg0, arg1); } ! /** * @see List#removeAll(Collection) --- 157,161 ---- return list.addAll( arg0, arg1); } ! /** * @see List#removeAll(Collection) *************** *** 165,169 **** return list.removeAll( arg0); } ! /** * @see List#retainAll(Collection) --- 165,169 ---- return list.removeAll( arg0); } ! /** * @see List#retainAll(Collection) *************** *** 173,177 **** return list.retainAll( arg0); } ! /** * @see List#clear() --- 173,177 ---- return list.retainAll( arg0); } ! /** * @see List#clear() *************** *** 181,185 **** list.clear(); } ! /** * @see List#get(int) --- 181,185 ---- list.clear(); } ! /** * @see List#get(int) *************** *** 189,193 **** return list.get( arg0); } ! /** * @see List#set(int, Object) --- 189,193 ---- return list.get( arg0); } ! /** * @see List#set(int, Object) *************** *** 197,201 **** return list.set( arg0, arg1); } ! /** * @see List#add(int, Object) --- 197,201 ---- return list.set( arg0, arg1); } ! /** * @see List#add(int, Object) *************** *** 205,209 **** list.add(arg0, arg1); } ! /** * @see List#remove(int) --- 205,209 ---- list.add(arg0, arg1); } ! /** * @see List#remove(int) *************** *** 213,217 **** return list.remove( arg0); } ! /** * @see List#indexOf(Object) --- 213,217 ---- return list.remove( arg0); } ! /** * @see List#indexOf(Object) *************** *** 221,225 **** return list.indexOf( arg0); } ! /** * @see List#lastIndexOf(Object) --- 221,225 ---- return list.indexOf( arg0); } ! /** * @see List#lastIndexOf(Object) *************** *** 229,233 **** return list.lastIndexOf( arg0); } ! /** * @see List#listIterator() --- 229,233 ---- return list.lastIndexOf( arg0); } ! /** * @see List#listIterator() *************** *** 237,241 **** return new ListIteratorProxy( list.listIterator() ); } ! /** * @see List#listIterator(int) --- 237,241 ---- return new ListIteratorProxy( list.listIterator() ); } ! /** * @see List#listIterator(int) *************** *** 245,249 **** return new ListIteratorProxy( list.listIterator(arg0) ); } ! /** * @see List#subList(int, int) --- 245,249 ---- return new ListIteratorProxy( list.listIterator(arg0) ); } ! /** * @see List#subList(int, int) *************** *** 253,257 **** return new ListProxy( list.subList(arg0, arg1) ); } ! /** * @see PersistentCollection#replaceElements(Map) --- 253,257 ---- return new ListProxy( list.subList(arg0, arg1) ); } ! /** * @see PersistentCollection#replaceElements(Map) *************** *** 264,268 **** } } ! /** * @see PersistentCollection#elements() --- 264,268 ---- } } ! /** * @see PersistentCollection#elements() *************** *** 274,293 **** return list.isEmpty(); } ! public String toString() { read(); return list.toString(); } ! /** * @see PersistentCollection#writeTo(PreparedStatement, CollectionPersister, Object, int) */ public void writeTo(PreparedStatement st, CollectionPersister persister, Object entry, int i, boolean writeOrder) ! throws HibernateException, SQLException { ! persister.writeElement(st, entry, writeOrder, session); persister.writeIndex(st, new Integer(i), writeOrder, session); } ! /** * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) --- 274,293 ---- return list.isEmpty(); } ! public String toString() { read(); return list.toString(); } ! /** * @see PersistentCollection#writeTo(PreparedStatement, CollectionPersister, Object, int) */ public void writeTo(PreparedStatement st, CollectionPersister persister, Object entry, int i, boolean writeOrder) ! throws HibernateException, SQLException { ! persister.writeElement(st, entry, writeOrder, session); persister.writeIndex(st, new Integer(i), writeOrder, session); } ! /** * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) *************** *** 302,306 **** return element; } ! /** * @see PersistentCollection#entries() --- 302,306 ---- return element; } ! /** * @see PersistentCollection#entries() *************** *** 316,320 **** } public void assemble(CollectionPersister persister) ! throws HibernateException, SQLException { int length = list.size(); --- 316,320 ---- } public void assemble(CollectionPersister persister) ! throws HibernateException, SQLException { int length = list.size(); *************** *** 324,328 **** list.add( persister.getElementType().assemble( (Serializable) old.get(i), session, null ) ); } ! } --- 324,328 ---- list.add( persister.getElementType().assemble( (Serializable) old.get(i), session, null ) ); } ! } *************** *** 335,341 **** } return result; ! } ! public Iterator getDeletes(Type elemType) throws HibernateException { java.util.Set deletes = new HashSet(); --- 335,341 ---- } return result; ! } ! public Iterator getDeletes(Type elemType) throws HibernateException { java.util.Set deletes = new HashSet(); *************** *** 345,359 **** return deletes.iterator(); } ! public boolean needsInserting(Object entry, int i,Type elemType) throws HibernateException { final java.util.List sn = (java.util.List) getSnapshot(); return i >= sn.size(); } ! public boolean needsUpdating(Object entry, int i, Type elemType) throws HibernateException { final java.util.List sn = (java.util.List) getSnapshot(); return i<sn.size() && !elemType.equals( list.get(i), sn.get(i) ); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#getIndex(Object, int) --- 345,359 ---- return deletes.iterator(); } ! public boolean needsInserting(Object entry, int i,Type elemType) throws HibernateException { final java.util.List sn = (java.util.List) getSnapshot(); return i >= sn.size(); } ! public boolean needsUpdating(Object entry, int i, Type elemType) throws HibernateException { final java.util.List sn = (java.util.List) getSnapshot(); return i<sn.size() && !elemType.equals( list.get(i), sn.get(i) ); } ! /** * @see net.sf.hibernate.collections.PersistentCollection#getIndex(Object, int) *************** *** 364,368 **** public List() {} ! /** * @see org.odmg.DList#concat(DList) --- 364,368 ---- public List() {} ! /** * @see org.odmg.DList#concat(DList) *************** *** 375,379 **** return new List(session, list); } ! /** * @see org.odmg.DArray#resize(int) --- 375,379 ---- return new List(session, list); } ! /** * @see org.odmg.DArray#resize(int) *************** *** 391,395 **** this.list = newlist; } ! public boolean equals(Object other) { read(); --- 391,395 ---- this.list = newlist; } ! public boolean equals(Object other) { read(); *************** *** 401,405 **** return list.hashCode(); } ! } --- 401,408 ---- return list.hashCode(); } ! } + + + Index: Map.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Map.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Map.java 3 Jan 2003 14:07:30 -0000 1.3 --- Map.java 4 Jan 2003 11:15:27 -0000 1.4 *************** *** 19,23 **** ! /** * A persistent wrapper for a java.util.Map */ --- 19,23 ---- ! /** * A persistent wrapper for a java.util.Map */ *************** *** 25,29 **** protected java.util.Map map; ! public Serializable snapshot(CollectionPersister persister) throws HibernateException { HashMap clonedMap = new HashMap( map.size() ); --- 25,29 ---- protected java.util.Map map; ! public Serializable snapshot(CollectionPersister persister) throws HibernateException { HashMap clonedMap = new HashMap( map.size() ); *************** *** 35,39 **** return clonedMap; } ! public boolean equalsSnapshot(Type elementType) throws HibernateException { java.util.Map xmap = (java.util.Map) getSnapshot(); --- 35,39 ---- return clonedMap; } ! public boolean equalsSnapshot(Type elementType) throws HibernateException { java.util.Map xmap = (java.util.Map) getSnapshot(); *************** *** 68,72 **** return map.size(); } ! /** * @see Map#isEmpty() --- 68,72 ---- return map.size(); } ! /** * @see Map#isEmpty() *************** *** 76,80 **** return map.isEmpty(); } ! /** * @see Map#containsKey(Object) --- 76,80 ---- return map.isEmpty(); } ! /** * @see Map#containsKey(Object) *************** *** 84,88 **** return map.containsKey(arg0); } ! /** * @see Map#containsValue(Object) --- 84,88 ---- return map.containsKey(arg0); } ! /** * @see Map#containsValue(Object) *************** *** 92,96 **** return map.containsValue(arg0) ; } ! /** * @see Map#get(Object) --- 92,96 ---- return map.containsValue(arg0) ; } ! /** * @see Map#get(Object) *************** *** 100,104 **** return map.get(arg0); } ! /** * @see Map#put(Object, Object) --- 100,104 ---- return map.get(arg0); } ! /** * @see Map#put(Object, Object) *************** *** 108,112 **** return map.put( arg0, arg1); } ! /** * @see Map#remove(Object) --- 108,112 ---- return map.put( arg0, arg1); } ! /** * @see Map#remove(Object) *************** *** 116,120 **** return map.remove( arg0); } ! /** * @see Map#putAll(Map) --- 116,120 ---- return map.remove( arg0); } ! /** * @see Map#putAll(Map) *************** *** 124,128 **** map.putAll(arg0); } ! /** * @see Map#clear() --- 124,128 ---- map.putAll(arg0); } ! /** * @see Map#clear() *************** *** 132,136 **** map.clear(); } ! /** * @see Map#keySet() --- 132,136 ---- map.clear(); } ! /** * @see Map#keySet() *************** *** 140,144 **** return new SetProxy( map.keySet() ); } ! /** * @see Map#values() --- 140,144 ---- return new SetProxy( map.keySet() ); } ! /** * @see Map#values() *************** *** 148,152 **** return new SetProxy( map.values() ); } ! /** * @see Map#entrySet() --- 148,152 ---- return new SetProxy( map.values() ); } ! /** * @see Map#entrySet() *************** *** 156,160 **** return new EntrySetProxy( map.entrySet() ); } ! /** * @see PersistentCollection#replaceElements(Map) --- 156,160 ---- return new EntrySetProxy( map.entrySet() ); } ! /** * @see PersistentCollection#replaceElements(Map) *************** *** 172,176 **** if ( n!=replacements.size() ) throw new HibernateException("Application error: don't use mutable values for keys of maps"); } ! /** * @see PersistentCollection#elements() --- 172,176 ---- if ( n!=replacements.size() ) throw new HibernateException("Application error: don't use mutable values for keys of maps"); } ! /** * @see PersistentCollection#elements() *************** *** 182,186 **** return map.isEmpty(); } ! public String toString() { read(); --- 182,186 ---- return map.isEmpty(); } ! public String toString() { read(); *************** *** 191,200 **** */ public void writeTo(PreparedStatement st, CollectionPersister persister, Object entry, int i, boolean writeOrder) ! throws HibernateException, SQLException { java.util.Map.Entry e = (java.util.Map.Entry) entry; persister.writeElement(st, e.getValue(), writeOrder, session); persister.writeIndex(st, e.getKey(), writeOrder, session); } ! /** * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) --- 191,200 ---- */ public void writeTo(PreparedStatement st, CollectionPersister persister, Object entry, int i, boolean writeOrder) ! throws HibernateException, SQLException { java.util.Map.Entry e = (java.util.Map.Entry) entry; persister.writeElement(st, e.getValue(), writeOrder, session); persister.writeIndex(st, e.getKey(), writeOrder, session); } ! /** * @see PersistentCollection#readFrom(ResultSet, CollectionPersister) *************** *** 206,210 **** return element; } ! /** * @see PersistentCollection#entries() --- 206,210 ---- return element; } ! /** * @see PersistentCollection#entries() *************** *** 220,224 **** } } ! /** a wrapper for Map.Entry sets */ class EntrySetProxy implements java.util.Set { --- 220,224 ---- } } ! /** a wrapper for Map.Entry sets */ class EntrySetProxy implements java.util.Set { *************** *** 307,313 **** } } ! public void assemble(CollectionPersister persister) ! throws HibernateException, SQLException { java.util.Map old = map; --- 307,313 ---- } } ! public void assemble(CollectionPersister persister) ! throws HibernateException, SQLException { java.util.Map old = map; *************** *** 316,325 **** while ( iter.hasNext() ) { java.util.Map.Entry e = (java.util.Map.Entry) iter.next(); ! map.put( ! persister.getIndexType().assemble( (Serializable) e.getKey(), session, null), ! persister.getElementType().assemble( (Serializable) e.getValue(), session, null ) ); } ! } --- 316,325 ---- while ( iter.hasNext() ) { java.util.Map.Entry e = (java.util.Map.Entry) iter.next(); ! map.put( ! persister.getIndexType().assemble( (Serializable) e.getKey(), session, null), ! persister.getElementType().assemble( (Serializable) e.getValue(), session, null ) ); } ! } *************** *** 330,342 **** while ( iter.hasNext() ) { java.util.Map.Entry e = (java.util.Map.Entry) iter.next(); ! result.put( ! persister.getIndexType().disassemble( e.getKey(), session ), ! persister.getElementType().disassemble( e.getValue(), session ) ); } return result; ! } ! public Iterator getDeletes(Type elemType) throws HibernateException { java.util.Set deletes = new HashSet(); --- 330,342 ---- while ( iter.hasNext() ) { java.util.Map.Entry e = (java.util.Map.Entry) iter.next(); ! result.put( ! persister.getIndexType().disassemble( e.getKey(), session ), ! persister.getElementType().disassemble( e.getValue(), session ) ); } return result; ! } ! public Iterator getDeletes(Type elemType) throws HibernateException { java.util.Set deletes = new HashSet(); *************** *** 349,353 **** return deletes.iterator(); } ! public boolean needsInserting(Object entry, int i, Type elemType) throws HibernateException { final java.util.Map sn = (java.util.Map) getSnapshot(); --- 349,353 ---- return deletes.iterator(); } ! public boolean needsInserting(Object entry, int i, Type elemType) throws HibernateException { final java.util.Map sn = (java.util.Map) getSnapshot(); *************** *** 355,359 **** return !sn.containsKey( e.getKey() ); } ! public boolean needsUpdating(Object entry, int i, Type elemType) throws HibernateException { final java.util.Map sn = (java.util.Map) getSnapshot(); --- 355,359 ---- return !sn.containsKey( e.getKey() ); } ! public boolean needsUpdating(Object entry, int i, Type elemType) throws HibernateException { final java.util.Map sn = (java.util.Map) getSnapshot(); *************** *** 361,366 **** return sn.containsKey( e.getKey() ) && !elemType.equals( e.getValue(), sn.get( e.getKey() ) ); } ! ! public Object getIndex(Object entry, int i) { return ( (java.util.Map.Entry) entry ).getKey(); --- 361,366 ---- return sn.containsKey( e.getKey() ) && !elemType.equals( e.getValue(), sn.get( e.getKey() ) ); } ! ! public Object getIndex(Object entry, int i) { return ( (java.util.Map.Entry) entry ).getKey(); *************** *** 368,372 **** public Map() {} ! public boolean equals(Object other) { read(); --- 368,372 ---- public Map() {} ! public boolean equals(Object other) { read(); *************** *** 378,382 **** return map.hashCode(); } ! } --- 378,385 ---- return map.hashCode(); } ! } + + + Index: ODMGCollection.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/ODMGCollection.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ODMGCollection.java 3 Jan 2003 14:07:30 -0000 1.2 --- ODMGCollection.java 4 Jan 2003 11:15:27 -0000 1.3 *************** *** 12,18 **** public abstract class ODMGCollection ! extends PersistentCollection ! implements DCollection { ! /** * Constructor for ODMGCollection. --- 12,18 ---- public abstract class ODMGCollection ! extends PersistentCollection ! implements DCollection { ! /** * Constructor for ODMGCollection. *************** *** 22,26 **** super(session); } ! /** * Constructor for ODMGCollection. --- 22,26 ---- super(session); } ! /** * Constructor for ODMGCo... [truncated message content] |