-->
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: Help needed with Hibernate properties file
PostPosted: Mon Oct 24, 2005 7:24 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.

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:
PostPosted: Mon Oct 24, 2005 7:42 am 
Regular
Regular

Joined: Mon Aug 29, 2005 9:46 am
Posts: 102
What directory are they in? Can you show us the structure?

_________________
Don't forget to rate if the post helped!


Top
 Profile  
 
 Post subject: Re: Help needed with Hibernate properties file
PostPosted: Mon Oct 24, 2005 7:54 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 with all other java files.

C:\myTest <---- name of my Project


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: Help needed with Hibernate properties file
PostPosted: Mon Oct 24, 2005 8:24 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
I see you've asked this same question twice but the answer is the same.

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.

See Section 4.7 in the Hibernate 3 Reference Doc.

_________________
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.