From: <one...@us...> - 2003-03-16 03:56:05
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/hbm2ddl In directory sc8-pr-cvs1:/tmp/cvs-serv25546/sf/hibernate/tool/hbm2ddl Modified Files: SchemaExport.java SchemaUpdate.java Log Message: use properties from Configuration in SchemaExport + SchemaUpdate Index: SchemaExport.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/hbm2ddl/SchemaExport.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SchemaExport.java 22 Feb 2003 06:42:07 -0000 1.8 --- SchemaExport.java 16 Mar 2003 03:56:02 -0000 1.9 *************** *** 13,17 **** import net.sf.hibernate.HibernateException; import net.sf.hibernate.cfg.Configuration; - import net.sf.hibernate.cfg.Environment; import net.sf.hibernate.connection.ConnectionProvider; import net.sf.hibernate.connection.ConnectionProviderFactory; --- 13,16 ---- *************** *** 30,42 **** private Properties connectionProperties; private String outputFile = null; /** * Create a schema exporter for the given Configuration */ ! public SchemaExport(Configuration ds) throws HibernateException { ! connectionProperties = Environment.getProperties(); ! Dialect dialect = Dialect.getDialect(); ! dropSQL = ds.generateDropSchemaScript(dialect); ! createSQL = ds.generateSchemaCreationScript(dialect); } --- 29,39 ---- private Properties connectionProperties; private String outputFile = null; + private Dialect dialect; /** * Create a schema exporter for the given Configuration */ ! public SchemaExport(Configuration cfg) throws HibernateException { ! this( cfg, cfg.getProperties() ); } *************** *** 45,53 **** * database connection properties. */ ! public SchemaExport(Configuration ds, Properties connectionProperties) throws HibernateException { this.connectionProperties = connectionProperties; ! Dialect dialect = Dialect.getDialect(connectionProperties); ! dropSQL = ds.generateDropSchemaScript(dialect); ! createSQL = ds.generateSchemaCreationScript(dialect); } --- 42,50 ---- * database connection properties. */ ! public SchemaExport(Configuration cfg, Properties connectionProperties) throws HibernateException { this.connectionProperties = connectionProperties; ! dialect = Dialect.getDialect(connectionProperties); ! dropSQL = cfg.generateDropSchemaScript(dialect); ! createSQL = cfg.generateSchemaCreationScript(dialect); } *************** *** 86,93 **** Statement statement = null; ! Properties givenProps = (connectionProperties==null) ? Environment.getProperties() : connectionProperties; Properties props = new Properties(); ! props.putAll( Dialect.getDialect(givenProps).getDefaultProperties() ); ! props.putAll(givenProps); boolean jdbc2 = false; --- 83,90 ---- Statement statement = null; ! //Properties givenProps = (connectionProperties==null) ? Environment.getProperties() : connectionProperties; Properties props = new Properties(); ! props.putAll( dialect.getDefaultProperties() ); ! props.putAll(connectionProperties); boolean jdbc2 = false; Index: SchemaUpdate.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/hbm2ddl/SchemaUpdate.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SchemaUpdate.java 9 Feb 2003 06:28:16 -0000 1.6 --- SchemaUpdate.java 16 Mar 2003 03:56:02 -0000 1.7 *************** *** 27,43 **** Log log = LogFactory.getLog( getClass() ); private ConnectionProvider cp; ! Configuration store; Dialect dialect; ! public SchemaUpdate(Configuration store) throws HibernateException, SQLException { ! this.store = store; ! dialect = Dialect.getDialect(); ! cp = ConnectionProviderFactory.newConnectionProvider(); } public SchemaUpdate(Configuration store, Properties connectionProperties) throws HibernateException { ! this.store = store; dialect = Dialect.getDialect(connectionProperties); ! cp = ConnectionProviderFactory.newConnectionProvider(connectionProperties); } --- 27,44 ---- Log log = LogFactory.getLog( getClass() ); private ConnectionProvider cp; ! Configuration cfg; Dialect dialect; ! public SchemaUpdate(Configuration cfg) throws HibernateException, SQLException { ! this( cfg, cfg.getProperties() ); } public SchemaUpdate(Configuration store, Properties connectionProperties) throws HibernateException { ! this.cfg = store; dialect = Dialect.getDialect(connectionProperties); ! Properties props = new Properties(); ! props.putAll( dialect.getDefaultProperties() ); ! props.putAll(connectionProperties); ! cp = ConnectionProviderFactory.newConnectionProvider(props); } *************** *** 90,94 **** String[] createSQL; ! createSQL = store.generateSchemaUpdateScript(dialect, info); for (int j = 0; j < createSQL.length; j++) { --- 91,95 ---- String[] createSQL; ! createSQL = cfg.generateSchemaUpdateScript(dialect, info); for (int j = 0; j < createSQL.length; j++) { |