• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Overriding xml file

 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

How can we override the xml config file in hibernate. For example, I want to override a property that I have in the hibernate.cfg.xml file. How can I override that property? Help guys!
 
Prasanna S Kumar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a method called setProperty which will accept two arguments.One is property name and other is property value .

This is the way , we can set any property

Configuration configuration = new Configuration();
configuration.setProperty("hibernate.connection.driver_class", org.hsqldb.jdbcDriver.class.getName());

Thanks,
Prasanna
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Prasanna S Kumar:
There is a method called setProperty which will accept two arguments.One is property name and other is property value .

This is the way , we can set any property

Configuration configuration = new Configuration();
configuration.setProperty("hibernate.connection.driver_class", org.hsqldb.jdbcDriver.class.getName());

Thanks,
Prasanna


This is fine. But the final value for hibernate.connection.driver_class will be the one that I have in my cfg.xml file. I want to know how I can override that?
 
Prasanna S Kumar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once setProperty() is executed the property will be overridden with new value
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Prasanna S Kumar:
Once setProperty() is executed the property will be overridden with new value


The final value will be determined programatically rather than from the cfg file?
 
Prasanna S Kumar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes , the final value will be determined programatically
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Prasanna S Kumar:
Yes , the final value will be determined programatically


Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic