Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister
In directory sc8-pr-cvs1:/tmp/cvs-serv6001/hibernate/persister
Modified Files:
EntityPersister.java
Log Message:
support for composite id class as target of key-many-to-one
Index: EntityPersister.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister/EntityPersister.java,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** EntityPersister.java 17 Jan 2003 10:27:10 -0000 1.49
--- EntityPersister.java 15 Feb 2003 04:31:06 -0000 1.50
***************
*** 107,114 ****
AbstractComponentType actype = (AbstractComponentType) idType;
String[] props = actype.getPropertyNames();
! if (props.length!=columns.length) throw new MappingException("broken mapping for: " + getClassName() + '.' + path);
for ( int i=0; i<props.length; i++ ) {
String subidpath = idpath + '.' + props[i];
! columnNamesByPropertyPath.put( subidpath, new String[] { columns[i] } );
mods.put( subidpath, actype.getSubtypes()[i] );
}
--- 107,121 ----
AbstractComponentType actype = (AbstractComponentType) idType;
String[] props = actype.getPropertyNames();
! Type[] subtypes = actype.getSubtypes();
! if ( actype.getColumnSpan(factory)!=columns.length )
! throw new MappingException("broken mapping for: " + getClassName() + '.' + path);
! int j=0;
for ( int i=0; i<props.length; i++ ) {
String subidpath = idpath + '.' + props[i];
! String[] componentColumns = new String[ subtypes[i].getColumnSpan(factory) ];
! for (int k = 0; k < componentColumns.length; k++) {
! componentColumns[k] = columns[j++];
! }
! columnNamesByPropertyPath.put(subidpath, componentColumns);
mods.put( subidpath, actype.getSubtypes()[i] );
}
|