From: <one...@us...> - 2002-11-24 11:48:14
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/map In directory sc8-pr-cvs1:/tmp/cvs-serv21277/cirrus/hibernate/map Modified Files: Collection.java IndexedCollection.java Set.java Table.java Log Message: fixed a bug where id column was sometimes nullable Index: Collection.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/map/Collection.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** Collection.java 8 Nov 2002 23:49:47 -0000 1.47 --- Collection.java 24 Nov 2002 11:48:11 -0000 1.48 *************** *** 24,28 **** // All can be made final except table ! private Value identifier; private Value element; private Table table; --- 24,28 ---- // All can be made final except table ! private Value key; private Value element; private Table table; *************** *** 48,53 **** } ! public Value getIdentifier() { ! return identifier; } public Value getElement() { --- 48,53 ---- } ! public Value getKey() { ! return key; } public Value getElement() { *************** *** 90,94 **** for ( int i=0; i<list.getLength(); i++ ) { String name = list.item(i).getNodeName(); ! if ( "one-to-many".equals(name) || "association".equals(name) ) { //association is deprecated isOneToMany = true; oneToMany = new OneToMany( list.item(i), owner ); --- 90,94 ---- for ( int i=0; i<list.getLength(); i++ ) { String name = list.item(i).getNodeName(); ! if ( "one-to-many".equals(name) ) { isOneToMany = true; oneToMany = new OneToMany( list.item(i), owner ); *************** *** 141,147 **** if ( "key".equals(name) || "generated-key".equals(name) ) { ! identifier = new Value(subnode, null, DEFAULT_KEY_COLUMN_NAME, isOneToMany, table, root); ! if (!toplevel) identifier.setType( owner.getIdentifier().getType() ); ! if ( identifier.getType().returnedClass().isArray() ) throw new MappingException( "illegal use of an array as an identifier (arrays don't reimplement equals)" ); --- 141,147 ---- if ( "key".equals(name) || "generated-key".equals(name) ) { ! key = new Value(subnode, null, DEFAULT_KEY_COLUMN_NAME, isOneToMany, table, root); ! if (!toplevel) key.setType( owner.getIdentifier().getType() ); ! if ( key.getType().returnedClass().isArray() ) throw new MappingException( "illegal use of an array as an identifier (arrays don't reimplement equals)" ); *************** *** 168,172 **** // no foreign key for a one-to-many ! if (!toplevel) identifier.createForeignKeyOfClass( root, table, owner.getPersistentClass() ); // no foreign key for a toplevel --- 168,172 ---- // no foreign key for a one-to-many ! if (!toplevel) key.createForeignKeyOfClass( root, table, owner.getPersistentClass() ); // no foreign key for a toplevel *************** *** 214,218 **** index.setName( StringHelper.suffix( table.getQualifiedName(), "IDX" + table.generateConstraintID() ) ); index.setTable(table); ! Iterator iter = getIdentifier().getColumnIterator(); while ( iter.hasNext() ) { index.addColumn( (Column) iter.next() ); --- 214,218 ---- index.setName( StringHelper.suffix( table.getQualifiedName(), "IDX" + table.generateConstraintID() ) ); index.setTable(table); ! Iterator iter = getKey().getColumnIterator(); while ( iter.hasNext() ) { index.addColumn( (Column) iter.next() ); Index: IndexedCollection.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/map/IndexedCollection.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** IndexedCollection.java 5 Oct 2002 07:52:10 -0000 1.8 --- IndexedCollection.java 24 Nov 2002 11:48:11 -0000 1.9 *************** *** 28,32 **** public void createPrimaryKey() { PrimaryKey pk = new PrimaryKey(); ! Iterator iter = getIdentifier().getColumnIterator(); while ( iter.hasNext() ) { pk.addColumn( (Column) iter.next() ); --- 28,32 ---- public void createPrimaryKey() { PrimaryKey pk = new PrimaryKey(); ! Iterator iter = getKey().getColumnIterator(); while ( iter.hasNext() ) { pk.addColumn( (Column) iter.next() ); Index: Set.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/map/Set.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Set.java 10 Oct 2002 05:52:13 -0000 1.13 --- Set.java 24 Nov 2002 11:48:11 -0000 1.14 *************** *** 53,57 **** public void createPrimaryKey() { PrimaryKey pk = new PrimaryKey(); ! Iterator iter = getIdentifier().getColumnIterator(); while ( iter.hasNext() ) { pk.addColumn( (Column) iter.next() ); --- 53,57 ---- public void createPrimaryKey() { PrimaryKey pk = new PrimaryKey(); ! Iterator iter = getKey().getColumnIterator(); while ( iter.hasNext() ) { pk.addColumn( (Column) iter.next() ); Index: Table.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/map/Table.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Table.java 4 Nov 2002 00:55:30 -0000 1.27 --- Table.java 24 Nov 2002 11:48:11 -0000 1.28 *************** *** 46,50 **** } public void addColumn(Column column) { ! this.columns.put( column.getName(), column ); } public int getColumnSpan() { --- 46,52 ---- } public void addColumn(Column column) { ! if ( columns.get( column.getName() )==null ) { ! columns.put( column.getName(), column ); ! } } public int getColumnSpan() { |