You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Simon Brunner (JIRA)" <ji...@apache.org> on 2005/03/21 21:53:21 UTC
[jira] Commented: (JCR-78) contrib/orm-persistence: Configuration-Attribute for HibernatePersistenceManager
[ http://issues.apache.org/jira/browse/JCR-78?page=comments#action_61350 ]
Simon Brunner commented on JCR-78:
----------------------------------
I added an attribute 'configurationFile' to the HibernatePersistenceManager to be able to set the name of the optional configuration file. In my example, the file 'hibernate_repo_web.cfg.xml' contains the mappings adjusted for the repository 'websites'.
The configuration would look like this:
<PersistenceManager class="org.apache.jackrabbit.core.state.orm.hibernate.HibernatePersistenceManager">
<param name="configurationFile" value="/hibernate_repo_web.cfg.xml" />
</PersistenceManager>
Suggested patch for HibernatePersistenceManager:
+++ HibernatePersistenceManager.java 2005/03/21 19:55:01
@@ -58,18 +58,41 @@
private static Logger log = Logger.getLogger(HibernatePersistenceManager.class);
private SessionFactory sessionFactory;
+
+ /**
+ * An optional reference to a Hibernate configuration file.
+ */
+ private String configurationFile = null;
public HibernatePersistenceManager() {
}
/**
+ * @return Returns the configurationFile.
+ */
+ public String getConfigurationFile() {
+ return configurationFile;
+ }
+
+ /**
+ * @param configurationFile The configurationFile to set.
+ */
+ public void setConfigurationFile(String configurationFile) {
+ this.configurationFile = configurationFile;
+ }
+
+ /**
* @see org.apache.jackrabbit.core.state.PersistenceManager#init
*/
public void init(PMContext context) throws Exception {
try {
// Create the SessionFactory
- sessionFactory = new Configuration().configure().
- buildSessionFactory();
+ if (configurationFile != null && configurationFile.length() > 0) {
+ sessionFactory = new Configuration().configure(configurationFile).buildSessionFactory();
+ } else {
+ sessionFactory = new Configuration().configure().
+ buildSessionFactory();
+ }
} catch (Throwable ex) {
log.error("Initial SessionFactory creation failed.", ex);
throw new ExceptionInInitializerError(ex);
> contrib/orm-persistence: Configuration-Attribute for HibernatePersistenceManager
> --------------------------------------------------------------------------------
>
> Key: JCR-78
> URL: http://issues.apache.org/jira/browse/JCR-78
> Project: Jackrabbit
> Type: Improvement
> Environment: JCR client applications with more than one repository using the HibernatePersistenceManager implementation in contrib/orm-persistence.
> Reporter: Simon Brunner
> Priority: Trivial
> Attachments: hpm_patch.txt
>
> Some applications use more than one repository. Magnolia CMS (www.magnolia.info) for example uses four repositories to store the websites, roles, users and the configuration independently. In my opinion, a small modification to the HibernatePersistenceManager located in contrib/orm-persistence would allow to specify an optional Hibernate configuration-file for each HibernatePersistenceManager configured within the same application (instead of having a global Hibernate mapping-file for the whole application). This would give us the possibility to use unique table prefixes for every repository (when stored into the same database/db-schema) or to use different databases/schemas for each repository.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira