• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use different hibernate configurations

 
Gerro Ragasa
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First let me start by saying that I just recently started learning hibernate, and that I got most of the answers for my first problems mostly by reading the threads from this forums and hibernate.org. If this question has been asked on another thread, I would like to apologize for double posting and please direct me to it so I won't trouble you any further.

My program is a desktop application that uses Eclipse RCP as a framework, if you can call it one. It uses Hibernate to persist the data. I am using the file hibernate.cfg.xml to specify my Hibernate configurations. My understanding is that it could also be done with the hibernate.properties. The current configurations connect my application to a MySQL database. Since it is NOT a web application where I can set the configurations and leave it as it is, I would like to give the user the freedom to specify the type of database connection they want to use, as long as it is supported by hibernate.

I'm not sure if this is possible or how much change needs to be done for it to work so if anyone has done it, or has any idea on how to go about it, I'd be happy to hear what you have to say.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anything set in hibernate.properties or hibernate.cfg.xml can be set programatically too. If you want to prompt your user for the database details and use those you can. Have a look at the JavaDocs for the Configuration class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic