From: Doug C. <de...@fl...> - 2002-02-03 20:43:44
|
I caught up with the HEAD stream today, and tried the NetworkInteractive example to see if it generated the sql for table creation. I found that it needed a System property for the driver, which is different from the old behavior. To repair this I made changes in cirrus.hibernate.Environment and cirrus.hibernate.impl.RelationalDatastore. In Environment I added a new version of dialect() and the cache code: private static Dialect dialectCache = null; public static Dialect dialect() throws HibernateException { if( dialectCache != null ) return dialectCache; try { dialectCache = (Dialect) Class.forName( System.getProperty(DIALECT) ).newInstance(); return dialectCache; } catch (Exception e) { throw new HibernateException("The dialect was not set, or did not exist"); } } public static Dialect dialect(Properties connectionProps) throws HibernateException { if( dialectCache != null ) return dialectCache; try { dialectCache = (Dialect) Class.forName( connectionProps.getProperty(DIALECT) ).newInstance(); return dialectCache; } catch (Exception e) { return dialect(); } } In RelationalDatastore I modified two methods (including changing the signature for generateSchema... public SessionFactory buildSessionFactory(Properties connectionProps) throws HibernateException { generateSchema(Environment.dialect(connectionProps)); Query.clearCache(); //ByIDQuery.clearCache(); return new RelationalDatabaseSessionFactory(this, connectionProps); } public void generateSchema(Dialect dialect) throws HibernateException { //Dialect dialect = Environment.dialect(); ... } Now I can run the NetworkInteractive example as before. It prints the create statements for the tables. It would be nice if it also provided the statements to create the necessary unique ID table(s). e |