pvmk wrote:
SIau_Tie wrote:
pvmk wrote:
shell i use both hibernate.properties and hibernate-config.xml for creating
org.hibernate.cfg.Configuration.
like i would like to use below properties from hibernate.properties
hibernate.connection.url=....
hibernate.connection.username=....
hibernate.connection.password=....
and remaining properties from hibernate-config.xml
Yeah.....in our projects, usually we define the mapping in hibernate.cfg.xml, n others configuration, we put in hibernate.properties
In that case how i will create org.hibernate.cfg.Configuration, how do i load hibernate.properties and hibernate-config.xml files. any sample code pls
You just call :
Code:
Configuration conf = new Configuration().configure();
When new Configuration() invoked, it will try to read the configuration from hibernate.properties. When configure() invoke, it will read hibernate.cfg.xml by default, or you can also call configure(String resourceXML) instead