From: Per L. (JIRA) <no...@at...> - 2006-05-09 12:18:28
|
configuration.setProperty("connection.url", newJdbcUrl) fails ------------------------------------------------------------- Key: HHH-1731 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1731 Project: Hibernate3 Type: Bug Components: core Versions: 3.1.2 Environment: WinXP, Tomcat 5.5, MySQL 5, Hibernate 3.1.2 Reporter: Per Lindberg Attachments: HibernateDatabase.java It appears that, after Configuration configuration = new Configuration().configure(cfgFileName); but before new SchemaExport(configuration).create(false,true); sessionFactory = configuration.buildSessionFactory() the JDBC Connection URL can't be changed with configuration.setProperty("connection.url", newJdbcUrl) Trying to do so causes configuration.getProperty to return the new value, but the SessionFactory gets confused and appears to use the old value. I have the impression that configure(cfgFileName) sets the properties of the Configuration in some "hard" way, so that later calls to setProperty are mostly ignored (except that getProperty returns the new value). The attached file attempts to do this, and fails. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Per L. (JIRA) <no...@at...> - 2006-05-09 12:31:30
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1731?page=comments#action_23053 ] Per Lindberg commented on HHH-1731: ----------------------------------- By the way: in the attached example, the calls to boolean dbExisted = Utils.ensureDb(dbUrl, userName, password); // local method if (!dbExisted) new SchemaExport(configuration).create(false,true); does create a new database with the new url (with Utils.ensureDb), but does not export a schema to it. This strengthens my suspicions that the configuration has been carved in stone by .configure and really can't be changed with .setProperty. > configuration.setProperty("connection.url", newJdbcUrl) fails > ------------------------------------------------------------- > > Key: HHH-1731 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1731 > Project: Hibernate3 > Type: Bug > Components: core > Versions: 3.1.2 > Environment: WinXP, Tomcat 5.5, MySQL 5, Hibernate 3.1.2 > Reporter: Per Lindberg > Attachments: HibernateDatabase.java > > Original Estimate: 1 hour > Remaining: 1 hour > > It appears that, after > Configuration configuration = new Configuration().configure(cfgFileName); > but before > new SchemaExport(configuration).create(false,true); > sessionFactory = configuration.buildSessionFactory() > the JDBC Connection URL can't be changed with > configuration.setProperty("connection.url", newJdbcUrl) > Trying to do so causes configuration.getProperty to return the new value, > but the SessionFactory gets confused and appears to use the old value. > I have the impression that configure(cfgFileName) sets the properties > of the Configuration in some "hard" way, so that later calls to setProperty > are mostly ignored (except that getProperty returns the new value). > The attached file attempts to do this, and fails. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Per L. (JIRA) <no...@at...> - 2006-05-09 14:11:31
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1731?page=comments#action_23055 ] Per Lindberg commented on HHH-1731: ----------------------------------- The basic problem appears to be that the property names specfied in the file read by .configure(cfgFilename) may be abbreviated (e.g. "connection.url" for "hibernate.connection.url") but NOT in the parameter to .setProperty! This should IMHO be fixed either by adding the same ability to expand an abbreviated property name to .setProperty (in the same way as .configure), or documenting the difference of behaviour in the JavaDoc. (It wouldn't hurt to make the JavaDoc more complete on this issue in any case). > configuration.setProperty("connection.url", newJdbcUrl) fails > ------------------------------------------------------------- > > Key: HHH-1731 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1731 > Project: Hibernate3 > Type: Bug > Components: core > Versions: 3.1.2 > Environment: WinXP, Tomcat 5.5, MySQL 5, Hibernate 3.1.2 > Reporter: Per Lindberg > Attachments: HibernateDatabase.java > > Original Estimate: 1 hour > Remaining: 1 hour > > It appears that, after > Configuration configuration = new Configuration().configure(cfgFileName); > but before > new SchemaExport(configuration).create(false,true); > sessionFactory = configuration.buildSessionFactory() > the JDBC Connection URL can't be changed with > configuration.setProperty("connection.url", newJdbcUrl) > Trying to do so causes configuration.getProperty to return the new value, > but the SessionFactory gets confused and appears to use the old value. > I have the impression that configure(cfgFileName) sets the properties > of the Configuration in some "hard" way, so that later calls to setProperty > are mostly ignored (except that getProperty returns the new value). > The attached file attempts to do this, and fails. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |