[
http://jira.jboss.com/jira/browse/JBSEAM-1387?page=all ]
Gavin King updated JBSEAM-1387:
-------------------------------
Component/s: Core
Fix Version/s: (was: 1.3.0.ALPHA)
Priority: Minor (was: Major)
Support for overriding .cfg.xml properties in HibernateFactory
(patch included)
--------------------------------------------------------------------------------
Key: JBSEAM-1387
URL:
http://jira.jboss.com/jira/browse/JBSEAM-1387
Project: JBoss Seam
Issue Type: Feature Request
Components: Core
Environment: Microcontainer
Reporter: Przemyslaw Jaskierski
Priority: Minor
Attachments: HibernateFactory-patch.diff.zip
Currently HibernateFactory supports only one type of configuration at a time: .cfg.xml
file or "programmatic" one passed by the cfgProperties property.
It would be great to have the ability to override individual properties from the
specified .cfg.xml file using cfgProperties property. For example, when you want to have
special value for hibernate.hbm2ddl.auto in case of tests only, and normal one in case of
production environment.
Applying my patch makes the following thing possible (instead of maintaing two almost
identicall hibernate.cfg.xml files):
<bean name="pecpHibernateSessionFactoryFactory"
class="pecp.core.seam.HibernateFactory">
<property name="cfgResourceName">
<inject bean="pecpHibernateConfigurationLocation"/>
</property>
<property name="namingStrategy">
<inject bean="underscoreAwareNamingStrategy"/>
</property>
<property name="cfgProperties">
<map class="java.util.Hashtable" keyClass="java.lang.String"
valueClass="java.lang.String">
<entry>
<key>hibernate.hbm2ddl.auto</key>
<value>create-drop</value>
</entry>
</map>
</property>
</bean>
I've kept original logical code flow intact, so when there is no cfgResourceName and
no cfgProperties set, Seam (as in original case) tries to call configuration.configure()
and try to configure from hibernate.cfg.xml file. To make override functionality work you
need to specify cfgResourceName property.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira