Return-Path: Delivered-To: apmail-incubator-jackrabbit-dev-archive@www.apache.org Received: (qmail 28930 invoked from network); 22 Mar 2005 02:20:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Mar 2005 02:20:04 -0000 Received: (qmail 34417 invoked by uid 500); 22 Mar 2005 01:25:22 -0000 Mailing-List: contact jackrabbit-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jackrabbit-dev@incubator.apache.org Delivered-To: mailing list jackrabbit-dev@incubator.apache.org Received: (qmail 34332 invoked by uid 99); 22 Mar 2005 01:25:21 -0000 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=INFO_TLD X-Spam-Check-By: apache.org Received: from ajax-1.apache.org (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 21 Mar 2005 17:25:21 -0800 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (8.12.11/8.12.11) with ESMTP id j2LKrLwp014377 for ; Mon, 21 Mar 2005 21:53:21 +0100 Message-ID: <1165997322.1111438401378.JavaMail.jira@ajax.apache.org> Date: Mon, 21 Mar 2005 21:53:21 +0100 (CET) From: "Simon Brunner (JIRA)" To: jackrabbit-dev@incubator.apache.org Subject: [jira] Commented: (JCR-78) contrib/orm-persistence: Configuration-Attribute for HibernatePersistenceManager In-Reply-To: <1637335412.1111438400726.JavaMail.jira@ajax.apache.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ 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: 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