[
http://opensource.atlassian.com/projects/hibernate/browse/HBX-1042?page=c...
]
Arnout Engelen commented on HBX-1042:
-------------------------------------
I'm using the Spring AnnotationSessionFactoryBean, which returns an
AnnotationConfiguration with
hibernate.connection.provider_class=org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.
SettingsFactory.buildSettings() does a createConnectionProvider(), which makes a new
LocalDataSourceConnectionProvider and tries to call .configure() on it, which tries to
look up the datasource in the LocalSessionFactoryBean. A this point, however, the
LocalSessionFactoryBean no longer provides the DataSource, and
LocalDataSourceConnectionProvider.configure() throws a HibernateException.
org.hibernate.HibernateException: No local DataSource found for configuration - dataSource
property must be set on LocalSessionFactoryBean
at
org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.configure(LocalDataSourceConnectionProvider.java:49)
at
org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
at
org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:414)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2069)
at org.hibernate.tool.hbm2x.doc.DocHelper.<init>(DocHelper.java:135)
I'm not sure if this could be considered a bug in Spring, but in any case it would be
really helpful if DocExporter could recover from this exception gracefully, perhaps
logging a warning?
Make DocHelper robust against failing buildSettings()
-----------------------------------------------------
Key: HBX-1042
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HBX-1042
Project: Hibernate Tools
Issue Type: Improvement
Components: hbm2doc
Reporter: Arnout Engelen
Attachments: dochelper.diff.txt
DocHelper calls cfg.buildSettings(). to get the Dialect, default catalog name and default
schema name.
However, cfg.buildSettings() may fail with a HibernateException (example below).
It would be nice to have DocHelper handle this more gracefully. Attached is a simple
patch that does this.
(background: I'd like to use the Configuration I'm getting from a Spring
LocalSessionFactoryBean, which after initial creation leaves its
LocalDataSourceConnectionProvider in a state that yiels a HibernateException when calling
'configure()' on it, which buildSettings() does. Because of this issue, I cannot
use the DocExporter for my Spring-based hibernate configurations)
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira