Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 22711 invoked from network); 29 Aug 2005 17:37:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 29 Aug 2005 17:37:59 -0000 Received: (qmail 4833 invoked by uid 500); 29 Aug 2005 17:37:48 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 4628 invoked by uid 500); 29 Aug 2005 17:37:45 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 4472 invoked by uid 99); 29 Aug 2005 17:37:44 -0000 X-ASF-Spam-Status: No, hits=0.4 required=10.0 tests=DATE_IN_PAST_06_12,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Aug 2005 10:37:44 -0700 Received: by ajax.apache.org (Postfix, from userid 99) id 52D2E18A; Mon, 29 Aug 2005 09:47:19 +0200 (CEST) From: bugzilla@apache.org To: commons-dev@jakarta.apache.org Subject: DO NOT REPLY [Bug 36397] - [configuration][PATCH] conditional directives in property files X-Bugzilla-Reason: AssignedTo Message-Id: <20050829074719.52D2E18A@ajax.apache.org> Date: Mon, 29 Aug 2005 09:47:19 +0200 (CEST) X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG� RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND� INSERTED IN THE BUG DATABASE. http://issues.apache.org/bugzilla/show_bug.cgi?id=36397 ------- Additional Comments From ebourg@apache.org 2005-08-29 09:47 ------- Interesting stuff indeed, but I'm not conviced putting code in a data file is a wise move. There are at least two alternative ways of achieving the same result with the current code, either by using 2 configuration files plus a property (from the system properties or from another configuration file) switching between the two, or by playing with the subsets, for example: db = jndi ## JNDI Datasource jndi.hibernate.connection.datasource = jdbc/test jndi.hibernate.connection.username = db2 jndi.hibernate.connection.password = db2 ## JTA transactions jndi.hibernate.transaction.factory_class = jndi.net.sf.hibernate.transaction.JTATransactionFactory jndi.jta.UserTransaction = jta/usertransaction jndi.jta.UserTransaction = javax.transaction.UserTransaction jndi.jta.UserTransaction = UserTransaction ## HypersonicSQL hypersonic.hibernate.transaction.factory_class = hypersonic.net.sf.hibernate.transaction.JDBCTransactionFactory hypersonic.hibernate.dialect = net.sf.hibernate.dialect.HSQLDialect hypersonic.hibernate.connection.driver_class = org.hsqldb.jdbcDriver hypersonic.hibernate.connection.username = sa hypersonic.hibernate.connection.url = jdbc:hsqldb:hsql://localhost ## PostgreSQL postgres.hibernate.transaction.factory_class = postgres.net.sf.hibernate.transaction.JDBCTransactionFactory postgres.hibernate.dialect = net.sf.hibernate.dialect.PostgreSQLDialect postgres.hibernate.connection.driver_class = org.postgresql.Driver postgres.hibernate.connection.url = jdbc:postgresql:template1 postgres.hibernate.connection.username = pg postgres.hibernate.connection.password and this code: Configuration conf = new PropertiesConfiguration("hibernate.properties"); conf = conf.subset(conf.getString("db")); With a .ini configuration the file could look even clearer: db = jndi [jndi] hibernate.connection.datasource = jdbc/test hibernate.connection.username = db2 hibernate.connection.password = db2 ## JTA transactions hibernate.transaction.factory_class = net.sf.hibernate.transaction.JTATransactionFactory jta.UserTransaction = jta/usertransaction jta.UserTransaction = javax.transaction.UserTransaction jta.UserTransaction = UserTransaction [hypersonic] hibernate.transaction.factory_class = net.sf.hibernate.transaction.JDBCTransactionFactory hibernate.dialect = net.sf.hibernate.dialect.HSQLDialect hibernate.connection.driver_class = org.hsqldb.jdbcDriver hibernate.connection.username = sa hibernate.connection.url = jdbc:hsqldb:hsql://localhost [postgres] hibernate.transaction.factory_class = net.sf.hibernate.transaction.JDBCTransactionFactory hibernate.dialect = net.sf.hibernate.dialect.PostgreSQLDialect hibernate.connection.driver_class = org.postgresql.Driver hibernate.connection.url = jdbc:postgresql:template1 hibernate.connection.username = pg hibernate.connection.password -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org