commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 36397] - [configuration][PATCH] conditional directives in property files
Date Mon, 29 Aug 2005 07:47:19 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=36397>.
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


Mime
View raw message