Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/impl
In directory usw-pr-cvs1:/tmp/cvs-serv31063/cirrus/hibernate/impl
Modified Files:
DatastoreImpl.java
Log Message:
dynamic schema update
Index: DatastoreImpl.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/impl/DatastoreImpl.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** DatastoreImpl.java 18 Oct 2002 11:02:20 -0000 1.19
--- DatastoreImpl.java 4 Nov 2002 00:55:30 -0000 1.20
***************
*** 201,205 ****
return ArrayHelper.toStringArray(script);
}
!
public String[] generateSchemaCreationScript(Dialect dialect) throws HibernateException {
secondPassCompile();
--- 201,205 ----
return ArrayHelper.toStringArray(script);
}
!
public String[] generateSchemaCreationScript(Dialect dialect) throws HibernateException {
secondPassCompile();
***************
*** 233,237 ****
return ArrayHelper.toStringArray(script);
}
!
// This method may be called many times!!
private void secondPassCompile() throws MappingException {
--- 233,294 ----
return ArrayHelper.toStringArray(script);
}
!
! public String[] generateSchemaUpdateScript(Dialect dialect, java.util.Map tableColumnInfo) throws HibernateException {
! secondPassCompile();
!
! ArrayList script = new ArrayList(50);
!
! Iterator iter = tables.iterator();
! while ( iter.hasNext() ) {
! Table table = (Table) iter.next();
! java.util.Map ci = (java.util.Map) tableColumnInfo.get(table.getName().toLowerCase());
! if (ci == null)
! {
! script.add(table.sqlCreateString(dialect, this));
! }
! else
! {
! final String sql = table.sqlAlterString(dialect, this, ci);
! if (sql != null)
! script.add(sql);
! }
! }
!
! iter = primaryKeys.iterator();
! while ( iter.hasNext() )
! {
! Constraint constraint = (Constraint) iter.next();
! if (!tableColumnInfo.containsKey(constraint.getName()))
! script.add( constraint.sqlCreateString(dialect, this) );
! }
! if( dialect.hasAlterTable() ) {
! iter = foreignKeys.iterator();
! while ( iter.hasNext() )
! {
! Constraint constraint = (Constraint) iter.next();
! if (!tableColumnInfo.containsKey(constraint.getName()))
! script.add( constraint.sqlCreateString(dialect, this) );
! }
! }
!
! iter = indexes.iterator();
! while ( iter.hasNext() )
! {
! Index constraint = (Index) iter.next();
! if (!tableColumnInfo.containsKey(constraint.getName()))
! script.add( constraint.sqlCreateString(dialect, this) );
! }
!
! /*
! iter = generators.values().iterator();
! while ( iter.hasNext() )
! {
! String[] lines = ( (PersistentIdentifierGenerator) iter.next() ).sqlCreateStrings(dialect);
! for ( int i=0; i<lines.length; i++ ) script.add( lines[i] );
! }
! */
!
! return ArrayHelper.toStringArray(script);
! }
// This method may be called many times!!
private void secondPassCompile() throws MappingException {
***************
*** 265,269 ****
public static final class EmptyInterceptor implements Interceptor, Serializable {
/**
! * @see cirrus.hibernate.Interceptor#onDelete(Object, Object[], String[], Type[])
*/
public void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) {
--- 322,326 ----
public static final class EmptyInterceptor implements Interceptor, Serializable {
/**
! * @see cirrus.hibernate.Interceptor#onDelete(Object, Serializable id, Object[], String[], Type[])
*/
public void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) {
|