-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Set System Properties from hibernate.cfg.xml?
PostPosted: Thu Jul 08, 2004 1:30 am 
Newbie

Joined: Wed Jul 07, 2004 11:15 pm
Posts: 6
Location: California, USA
My apologies in advance if this is not the right forum.

Our persistence layer is implemented using Hibernate; both MSSQL and Orace are supported. We often use P6Spy for debugging. Personally I find this to be a great combination. But to switch from one database to another two property files have to be modified: spy for driver name and hibernate for connection parameters.

For my personal purposes I have modified hibernate and P6Spy as follows:
1. In Hibernate (cfg.Configuration.addProperites actually) if the name of the property being set starts with "env." then strip the part set the property using System.setProperty.
2. In P6Spy allow system properties that start with "p6spy." to overide the properties specified in spy.properties.
Then I switch between different values of "env.p6spy.realdriver" and "hibernate.connection.driver_class" in hibernate.cfg.xml.

Is this a bad idea? Is there a better alternative? Thanks in advance for your comments.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 08, 2004 11:46 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
It's good idea and solution, but I think we shouldn't make it default Hibernate behavior. The configuration process is already too complex for some people.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 08, 2004 12:53 pm 
Newbie

Joined: Wed Jul 07, 2004 11:15 pm
Posts: 6
Location: California, USA
Thanks for the quick response, Christian. I agree that the configuration process is rather complex, but I am keen to have this or some similar functionality available.

Would you consider some other similar scheme, say using a different tag systemProperty to set system property instead of switching on the name of the property? Unless some such functionality is available I have to patch every time I update my local copy of hibernate.cfg.xml and unpatch (if there is such a thing :) before committing it.

Thanks in advance.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.