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 Tue, 30 Aug 2005 11:26:08 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-30 13:26 -------
I agree with Oliver, we'd better improve the configuration descriptor than
adding logic to the configuration file. Here is an alternative that looks easier
to me :

1. put the default hibernate properties in a main configuration file
(hibernate.properties)

2. put the database specific properties in a specific file :

	hibernate.jndi.properties
	
		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
	
	hibernate.hypersonic.properties
	
		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
		
	hibernate.postgres.properties
	
		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


3. create a configuration descriptor (config.xml)

<configuration>
  <properties fileName="custom.properties"/>
  <properties fileName="hibernate.${db}.properties"/>
  <properties fileName="hibernate.properties"/>
</configuration>

The ${db} property would be declared in custom.properties. This will not work
right now because ConfigurationFactory doesn't interpolate the variables in the
attributes, but this is an improvement I've been willing to implement for a long
time.


-- 
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