Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister
In directory usw-pr-cvs1:/tmp/cvs-serv5635/hibernate/persister
Modified Files:
EntityPersister.java Loadable.java
MultiTableEntityPersister.java Queryable.java
Log Message:
support for collections/associations with MultiTableEntityPersister
Index: EntityPersister.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister/EntityPersister.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** EntityPersister.java 3 Nov 2002 06:19:59 -0000 1.34
--- EntityPersister.java 4 Nov 2002 08:10:51 -0000 1.35
***************
*** 175,178 ****
--- 175,182 ----
}
+ /**
+ * Return an array of all column names used by all subclasses
+ * of the persistent class
+ */
public String[] getSubclassColumnClosure() {
return subclassColumnClosure;
***************
*** 944,948 ****
}
! public String getQueryFromClause(String name) {
return getTableName() + ' ' + name;
}
--- 948,952 ----
}
! public String fromClauseFragment(String name) {
return getTableName() + ' ' + name;
}
***************
*** 992,996 ****
}
! public String selectPropertiesString(String name, String suffix) {
StringBuffer buf = new StringBuffer(30);
--- 996,1000 ----
}
! public String propertySelectClauseFragment(String name, String suffix) {
StringBuffer buf = new StringBuffer(30);
Index: Loadable.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister/Loadable.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Loadable.java 22 Oct 2002 20:22:16 -0000 1.9
--- Loadable.java 4 Nov 2002 08:10:51 -0000 1.10
***************
*** 1,4 ****
--- 1,5 ----
package cirrus.hibernate.persister;
+ import cirrus.hibernate.QueryException;
import cirrus.hibernate.type.DiscriminatorType;
import cirrus.hibernate.type.Type;
***************
*** 49,54 ****
* Get the fully-qualified tablename used to persist this class
*/
- // TODO: need to change this to String[] getTableNames() to support
- // outerjoin loading for multi-table mapping
public String getTableName();
--- 50,53 ----
***************
*** 79,86 ****
/**
! * Return an array of all column names used by all subclasses
! * of the persistent class (optional operation)
*/
! public String[] getSubclassColumnClosure() ;
!
}
--- 78,94 ----
/**
! * Given a query alias and an identifying suffix, render the
! * property select fragment
*/
! public String propertySelectClauseFragment(String name, String suffix);
! /**
! * Get the from clause fragment, given a query alias
! */
! public String fromClauseFragment(String name);
! /**
! * Given a query alias and a property path, return the qualified
! * column name
! */
! public String[] toColumns(String name, String property) throws QueryException;
!
}
Index: MultiTableEntityPersister.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister/MultiTableEntityPersister.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** MultiTableEntityPersister.java 3 Nov 2002 06:19:59 -0000 1.24
--- MultiTableEntityPersister.java 4 Nov 2002 08:10:51 -0000 1.25
***************
*** 5,8 ****
--- 5,9 ----
import cirrus.hibernate.helpers.JDBCExceptionReporter;
import cirrus.hibernate.helpers.StringHelper;
+ import cirrus.hibernate.loader.EntityLoader;
import cirrus.hibernate.loader.SimpleEntityLoader;
import cirrus.hibernate.loader.UniqueEntityLoader;
***************
*** 148,152 ****
! UniqueEntityLoader loader = new SimpleEntityLoader(this, generateSelectString(), LockMode.READ);
loaders.put( LockMode.NONE, loader );
--- 149,154 ----
! UniqueEntityLoader loader = //new SimpleEntityLoader(this, generateSelectString(), LockMode.READ);
! new EntityLoader(this, factory);
loaders.put( LockMode.NONE, loader );
***************
*** 329,333 ****
int count = 0;
StringBuffer setters = new StringBuffer(20);
! for (int i=0; i<columnNames.length; i++) {
if ( propertyTables[i]==j ) {
for ( int k=0; k<propertyColumnNames[i].length; k++ ) {
--- 331,335 ----
int count = 0;
StringBuffer setters = new StringBuffer(20);
! for (int i=0; i<getPropertyTypes().length; i++) {
if ( propertyTables[i]==j ) {
for ( int k=0; k<propertyColumnNames[i].length; k++ ) {
***************
*** 929,934 ****
propertyColumnSpans[i] = prop.getColumnSpan();
! String[] colNames = new String[ propertyColumnSpans[i] ];
! String[] aliases = new String[ propertyColumnSpans[i] ];
Iterator colIter = prop.getColumnIterator();
int j=0;
--- 931,936 ----
propertyColumnSpans[i] = prop.getColumnSpan();
! String[] propCols = new String[ propertyColumnSpans[i] ];
! String[] propAliases = new String[ propertyColumnSpans[i] ];
Iterator colIter = prop.getColumnIterator();
int j=0;
***************
*** 936,946 ****
Column col = (Column) colIter.next();
String colname = col.getName();
! colNames[j] = colname;
! aliases[j] = columnAlias(col);
columns.add(colname);
j++;
}
! propertyColumnNames[i] = colNames;
! propertyColumnNameAliases[i] = aliases;
initPropertyPaths(prop, "");
--- 938,948 ----
Column col = (Column) colIter.next();
String colname = col.getName();
! propCols[j] = colname;
! propAliases[j] = columnAlias(col);
columns.add(colname);
j++;
}
! propertyColumnNames[i] = propCols;
! propertyColumnNameAliases[i] = propAliases;
initPropertyPaths(prop, "");
***************
*** 1012,1022 ****
if ( model.isPolymorphic() ) {
subclassesByDiscriminatorValue = new HashMap();
! subclassesByDiscriminatorValue.put( discriminatorValue, mappedClass );
discriminators = new String[subclassSpan];
discriminators[subclassSpan-1] = discriminatorSQLString;
tableNumbers = new int[subclassSpan];
! tableNumbers[subclassSpan-1] = getTableId(qualifiedTableName, subclassTableNameClosure);
notNullColumns = new String[subclassSpan];
! notNullColumns[subclassSpan-1] = identifierColumnNames[0];
}
else {
--- 1014,1027 ----
if ( model.isPolymorphic() ) {
subclassesByDiscriminatorValue = new HashMap();
! subclassesByDiscriminatorValue.put(discriminatorValue, mappedClass);
discriminators = new String[subclassSpan];
discriminators[subclassSpan-1] = discriminatorSQLString;
tableNumbers = new int[subclassSpan];
! tableNumbers[subclassSpan-1] = getTableId(
! model.getTable().getQualifiedName( factory.getDefaultSchema() ),
! subclassTableNameClosure
! );
notNullColumns = new String[subclassSpan];
! notNullColumns[subclassSpan-1] = ( (Column) model.getTable().getPrimaryKey().getColumnIterator().next() ).getName();
}
else {
***************
*** 1103,1107 ****
}
! public String getQueryFromClause(String name) {
String[] tables = subclassTableNameClosure;
StringBuffer buf = new StringBuffer(100);
--- 1108,1112 ----
}
! public String fromClauseFragment(String name) {
String[] tables = subclassTableNameClosure;
StringBuffer buf = new StringBuffer(100);
***************
*** 1181,1185 ****
}
! public String selectPropertiesString(String name, String suffix) {
StringBuffer buf = new StringBuffer(50);
--- 1186,1190 ----
}
! public String propertySelectClauseFragment(String name, String suffix) {
StringBuffer buf = new StringBuffer(50);
***************
*** 1198,1203 ****
}
buf.append(" end as ")
! .append( getDiscriminatorColumnName() )
! .append(suffix);
}
--- 1203,1207 ----
}
buf.append(" end as ")
! .append( aliasColumn( getDiscriminatorColumnName(), suffix) );
}
***************
*** 1212,1217 ****
.append( cols[i] )
.append(" as ")
! .append(cols[i])
! .append(suffix);
}
return buf.toString();
--- 1216,1220 ----
.append( cols[i] )
.append(" as ")
! .append( aliasColumn( subclassColumnClosureAliases[i], suffix) );
}
return buf.toString();
Index: Queryable.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister/Queryable.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Queryable.java 26 Oct 2002 16:01:13 -0000 1.4
--- Queryable.java 4 Nov 2002 08:10:52 -0000 1.5
***************
*** 3,7 ****
import cirrus.hibernate.MappingException;
- import cirrus.hibernate.QueryException;
import cirrus.hibernate.type.Type;
--- 3,6 ----
***************
*** 29,51 ****
/**
- * Get the from clause fragment, given a query alias
- */
- public String getQueryFromClause(String name);
- /**
* Get the where clause fragment, given a query alias
*/
public String getQueryWhereClause(String name) throws MappingException;
- /**
- * Given a query alias and a property path, return the qualified
- * column name
- */
- public String[] toColumns(String name, String property) throws QueryException;
-
- /**
- * Given a query alias and an identifying suffix, render the
- * property select fragment
- */
- public String selectPropertiesString(String name, String suffix);
/**
* Given a query alias and an identifying suffix, render the
--- 28,35 ----
|