-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibarnet.cfg.xml not picking data from Hibernate.properties
PostPosted: Mon Oct 24, 2005 6:54 am 
Newbie

Joined: Mon Oct 24, 2005 6:44 am
Posts: 11
Hi

I am very new to Hibernate technology.

I have created Hibernate.properties and Hibarnet.cfg.xml.
I have place both this files into a project root directory.

When I run my test application. It find hibernate.properties and hibernate.cfg.xml files. But for some reason, data in a hibernate.cfg.xml is empy. Data from properties file is not been pickup my hibernate.cfg.xml.

Doesn't hibernate.cfg.xml, suppose to pickup data automatically from properties files.

I am lost here.

Please could you help me.

Many thank


Top
 Profile  
 
 Post subject: Re: Hibarnet.cfg.xml not picking data from Hibernate.propert
PostPosted: Mon Oct 24, 2005 7:01 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
Re-read the documentation regarding these files. Data from hibernate.properties does not get copied into the hibernate.cfg.xml. The files each provide a method for configuring Hibernate. One as a standard Java properties file, the other using XML.

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


Top
 Profile  
 
 Post subject: Re: Hibarnet.cfg.xml not picking data from Hibernate.propert
PostPosted: Mon Oct 24, 2005 7:13 am 
Newbie

Joined: Mon Oct 24, 2005 6:44 am
Posts: 11
ishfady wrote:
Hi

I am very new to Hibernate technology.

I have created Hibernate.properties and Hibarnet.cfg.xml.
I have place both this files into a project root directory.

When I run my test application. It find hibernate.properties and hibernate.cfg.xml files. But for some reason, data in a hibernate.cfg.xml is empy. Data from properties file is not been pickup my hibernate.cfg.xml.

Doesn't hibernate.cfg.xml, suppose to pickup data automatically from properties files.

here is the files
hibernate.properties

# dialect to be used
hibernate.dialect = org.hibernate.dialect.MySQLDialect
# driver used
hibernate.connection.driver_class=com.mysql.jdbc.Driver
# database name
hibernate.connection.url=jdbc:mysql:///myTest


hibernate.cfg.xml
<hibernate-configuration>
<session-factory>
<property name="dialect"></property>
<property name="connection.driver_class"></property>
<property name="connection.url"></property>
</session-factory>
</hibernate-configuration>

I was expected property: name, connection.driver_class, connection.url to be pickup from hibernate.properties file.

I am lost here.

Please could you help me.

Many thank


Top
 Profile  
 
 Post subject: Re: Hibarnet.cfg.xml not picking data from Hibernate.propert
PostPosted: Mon Oct 24, 2005 7:27 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
I'm not 100% sure but I believe that if you specify both files, then the hibernate.cfg.xml will overwrite the hibernate.properties file. Since you have the fields specified, with empty values, the empty values overwrite the valid values. You only need to use 1 of these files. Just specify all of the details in the hibernate.cfg.xml and everything should work fine.

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.