Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister
In directory sc8-pr-cvs1:/tmp/cvs-serv20057/hibernate/persister
Modified Files:
AbstractEntityPersister.java EntityPersister.java
Loadable.java MultiTableEntityPersister.java
Log Message:
LockMode now serializes itself correctly
general code cleanups to persister package
some JavaDoc improvs
Index: AbstractEntityPersister.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister/AbstractEntityPersister.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** AbstractEntityPersister.java 26 Nov 2002 03:35:44 -0000 1.16
--- AbstractEntityPersister.java 26 Nov 2002 14:47:29 -0000 1.17
***************
*** 44,50 ****
/**
! * Superclass for built-in mapping strategies
*/
! public abstract class AbstractEntityPersister implements Queryable, ClassMetadata {
private static final Log log = LogFactory.getLog(AbstractEntityPersister.class);
--- 44,53 ----
/**
! * Superclass for built-in mapping strategies. Implements functionality
! * common to both mapping strategies.<br>
! * <br>
! * May be considered an immutable view of the mapping object.<br>
*/
! abstract class AbstractEntityPersister implements Queryable, ClassMetadata {
private static final Log log = LogFactory.getLog(AbstractEntityPersister.class);
Index: EntityPersister.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister/EntityPersister.java,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** EntityPersister.java 26 Nov 2002 08:37:25 -0000 1.44
--- EntityPersister.java 26 Nov 2002 14:47:29 -0000 1.45
***************
*** 46,52 ****
/**
* The default implementation of the <tt>ClassPersister</tt> interface.
! * Implements persistence for an entity class.<br>
! * <br>
! * May be considered an immutable view of the mapping object.<br>
*/
public class EntityPersister extends AbstractEntityPersister implements Queryable {
--- 46,51 ----
/**
* The default implementation of the <tt>ClassPersister</tt> interface.
! * Implements the "table-per-class hierarchy" mapping strategy for an entity
! * class.<br>
*/
public class EntityPersister extends AbstractEntityPersister implements Queryable {
***************
*** 78,82 ****
private transient final DiscriminatorType discriminatorType;
- private transient final Object discriminatorValue;
private transient final String discriminatorSQLString;
--- 77,80 ----
***************
*** 206,209 ****
--- 204,211 ----
}
+ protected String[] getColumnNames() {
+ return columnNames;
+ }
+
//Access cached SQL
***************
*** 243,247 ****
protected String generateDeleteString() {
StringBuffer buf = new StringBuffer("delete from ")
! .append(qualifiedTableName)
.append(" where ")
.append( StringHelper.join( " = ? and ", getIdentifierColumnNames() ) )
--- 245,249 ----
protected String generateDeleteString() {
StringBuffer buf = new StringBuffer("delete from ")
! .append( getTableName() )
.append(" where ")
.append( StringHelper.join( " = ? and ", getIdentifierColumnNames() ) )
***************
*** 260,263 ****
--- 262,266 ----
protected String generateInsertString(boolean identityInsert, String identityColumnInsertString) {
+ String[] columnNames = getColumnNames();
boolean hasPropertyColumns = columnNames.length > 0;
boolean insertIdentifierColumns = !identityInsert || identityColumnInsertString!=null;
***************
*** 266,270 ****
StringBuffer buf = new StringBuffer("insert into ")
! .append(qualifiedTableName)
.append(" ( ")
.append( cirrus.hibernate.helpers.StringHelper.join( ", ", columnNames ) )
--- 269,273 ----
StringBuffer buf = new StringBuffer("insert into ")
! .append( getTableName() )
.append(" ( ")
.append( cirrus.hibernate.helpers.StringHelper.join( ", ", columnNames ) )
***************
*** 307,310 ****
--- 310,314 ----
*/
protected String generateSelectString() {
+ final String[] subclassColumnClosure = getSubclassColumnClosure();
return new StringBuffer(100)
.append("select ")
***************
*** 314,318 ****
.append( StringHelper.join( ", ", subclassColumnClosure ) )
.append(" from ")
! .append(qualifiedTableName)
.append(" where ")
.append( StringHelper.join( " = ? and ", getIdentifierColumnNames() ) )
--- 318,322 ----
.append( StringHelper.join( ", ", subclassColumnClosure ) )
.append(" from ")
! .append( getTableName() )
.append(" where ")
.append( StringHelper.join( " = ? and ", getIdentifierColumnNames() ) )
***************
*** 325,328 ****
--- 329,333 ----
*/
protected String generateUpdateString() {
+ String[] columnNames = getColumnNames();
StringBuffer setters = new StringBuffer(20);
for (int i=0; i<columnNames.length; i++) {
***************
*** 332,336 ****
StringBuffer buf = new StringBuffer(100)
.append("update ")
! .append(qualifiedTableName)
.append(" set ")
.append( setters.toString() )
--- 337,341 ----
StringBuffer buf = new StringBuffer(100)
.append("update ")
! .append( getTableName() )
.append(" set ")
.append( setters.toString() )
***************
*** 354,358 ****
.append( getIdentifierColumnNames()[0] )
.append(" from ")
! .append(qualifiedTableName)
.append(" where ")
.append( StringHelper.join( " = ? and ", getIdentifierColumnNames() ) ) //TODO:refactor out copied code
--- 359,363 ----
.append( getIdentifierColumnNames()[0] )
.append(" from ")
! .append( getTableName() )
.append(" where ")
.append( StringHelper.join( " = ? and ", getIdentifierColumnNames() ) ) //TODO:refactor out copied code
***************
*** 633,636 ****
--- 638,642 ----
// DISCRIMINATOR
+ final Object discriminatorValue;
if ( model.isPolymorphic() ) {
Value d = model.getDiscriminator();
Index: Loadable.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister/Loadable.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** Loadable.java 26 Nov 2002 08:37:25 -0000 1.15
--- Loadable.java 26 Nov 2002 14:47:29 -0000 1.16
***************
*** 84,87 ****
--- 84,88 ----
* Given the number of a property of a subclass, and a table alias,
* return the aliased column names
+ * (optional operation)
*/
public String[] toColumns(String name, int i);
***************
*** 90,109 ****
* 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, boolean innerJoin);
/**
! * Get any the outer join SQL fragments that appear in the <tt>FROM</tt> clause
*/
public String outerJoinsAfterFrom(String name, boolean innerJoin);
/**
! * Get any the outer join SQL fragments that appear in the <tt>WHERE</tt> clause
*/
public String outerJoinsAfterWhere(String name, boolean innerJoin);
/**
! *
*/
public String getConcreteClassAlias(String alias);
--- 91,115 ----
* Given a query alias and an identifying suffix, render the
* property select fragment
+ * (optional operation)
*/
public String propertySelectClauseFragment(String name, String suffix);
/**
* Get the from clause fragment, given a query alias
+ * (optional operation)
*/
public String fromClauseFragment(String name, boolean innerJoin);
/**
! * Get any outer join SQL fragments that appear in the <tt>FROM</tt> clause
! * (optional operation)
*/
public String outerJoinsAfterFrom(String name, boolean innerJoin);
/**
! * Get any outer join SQL fragments that appear in the <tt>WHERE</tt> clause
! * (optional operation)
*/
public String outerJoinsAfterWhere(String name, boolean innerJoin);
/**
! * Get the table alias for the particular subclass state
! * (optional operation)
*/
public String getConcreteClassAlias(String alias);
Index: MultiTableEntityPersister.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister/MultiTableEntityPersister.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** MultiTableEntityPersister.java 26 Nov 2002 08:37:25 -0000 1.39
--- MultiTableEntityPersister.java 26 Nov 2002 14:47:29 -0000 1.40
***************
*** 49,56 ****
* A <tt>ClassPersister</tt> implementing the normalized "table-per-subclass"
* mapping strategy.<br>
- * <br>
- * <em>Experimental</em>
*/
! public class MultiTableEntityPersister extends AbstractEntityPersister implements Queryable {
private final SessionFactoryImplementor factory;
--- 49,54 ----
* A <tt>ClassPersister</tt> implementing the normalized "table-per-subclass"
* mapping strategy.<br>
*/
! public class MultiTableEntityPersister extends AbstractEntityPersister {
private final SessionFactoryImplementor factory;
***************
*** 78,82 ****
private transient final int[] subclassPropertyTableNumberClosure;
- private transient final String[] columnNames;
private transient final String[] subclassColumnClosure;
private transient final String[] subclassColumnClosureAliases;
--- 76,79 ----
***************
*** 93,97 ****
private transient final DiscriminatorType discriminatorType;
- private transient final Object discriminatorValue;
private transient final String discriminatorSQLString;
private transient final String discriminatorColumnName;
--- 90,93 ----
***************
*** 355,359 ****
.append( getIdentifierColumnNames()[0] )
.append(" from ")
! .append(qualifiedTableName)
.append(" where ")
.append( StringHelper.join( " = ? and ", getIdentifierColumnNames() ) ) //TODO:refactor out copied code
--- 351,355 ----
.append( getIdentifierColumnNames()[0] )
.append(" from ")
! .append( getTableName() )
.append(" where ")
.append( StringHelper.join( " = ? and ", getIdentifierColumnNames() ) ) //TODO:refactor out copied code
***************
*** 681,684 ****
--- 677,681 ----
// DISCRIMINATOR
+ final Object discriminatorValue;
if ( model.isPolymorphic() ) {
discriminatorColumnName = "clazz_";
***************
*** 755,759 ****
propertyColumnSpans = new int[hydrateSpan];
- ArrayList columns = new ArrayList();
HashSet thisClassProperties = new HashSet();
--- 752,755 ----
***************
*** 778,782 ****
propCols[j] = colname;
propAliases[j] = col.getName() + tab.getUniqueInteger() + '_';
- columns.add(colname);
j++;
}
--- 774,777 ----
***************
*** 792,798 ****
}
! columnNames = (String[]) columns.toArray(STRING_ARRAY);
!
! columns.clear();
ArrayList types = new ArrayList();
ArrayList propColumns = new ArrayList();
--- 787,791 ----
}
! ArrayList columns = new ArrayList();
ArrayList types = new ArrayList();
ArrayList propColumns = new ArrayList();
***************
*** 1074,1078 ****
}
buf.append(" end as ")
! .append( aliasColumn( discriminatorColumnName, suffix) );
}
--- 1067,1071 ----
}
buf.append(" end as ")
! .append( aliasColumn( getDiscriminatorColumnName(), suffix) );
}
|