aspose file tools*
The moose likes Struts and the fly likes ReUsing connection properties from hibernate.cfg.xml to properties file in Struts2 Framework Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "ReUsing connection properties from hibernate.cfg.xml to properties file in Struts2 Framework" Watch "ReUsing connection properties from hibernate.cfg.xml to properties file in Struts2 Framework" New topic
Author

ReUsing connection properties from hibernate.cfg.xml to properties file in Struts2 Framework

sangram nani
Greenhorn

Joined: Nov 27, 2011
Posts: 21
Hi Friends,

In my struts2 web-application with Hibernate3.5 ORM, we are using the default hibernate.cfg.xml for all db properties. In the hibernate.cfg.xml file the following properties, I want to use in quartz.properties file @ startup(when the application initializes).

<property name="hibernate.dialect">com.generalsentiment.dialect.MySQL5InnoDB</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>

<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/gsraisin?useUnicode=true&characterEncoding=UTF-8</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">rootAdmin</property>

The reason why i can't hardcode the same in quartz.properties file is because in the production servers we have different properties for different environments. Please suggest me what changes i need to do in order get the properties files these properties at startup.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8866
    
    8

sangram nani wrote:
The reason why i can't hardcode the same in quartz.properties file is because in the production servers we have different properties for different environments.


Why doesn't the hibernate configuration file change with each environment?
Take a look at this discussion on managing different environments.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
 
subject: ReUsing connection properties from hibernate.cfg.xml to properties file in Struts2 Framework