• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using hibernate.properties

 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it possible to use hibernate.properties alone

or else i have to use along with hibernate.cfg.xml

when i use hibernate.cfg.xml alone my application is working fine

if i use hibernate.properties (set in classpath)alone it looks for

searching hibernate.cfg.

[console output]
Oct 4, 2006 8:35:40 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.1.2
Oct 4, 2006 8:35:40 PM org.hibernate.cfg.Environment <clinit>
INFO: loaded properties from resource hibernate.properties: {hibernate.connectio
n.username=root, hibernate.connection.password=****, hibernate.cglib.use_reflect
ion_optimizer=true, hibernate.dialect=org.hibernate.dialect.MySQLDialect, hibern
ate.show_sql=true, hibernate.connection.url=jdbc:mysql://localhost:3306/test, hi
bernate.connection.driver_class=com.mysql.jdbc.Driver, hibernate.hbm2ddl.auto=up
date}
Oct 4, 2006 8:35:40 PM org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Oct 4, 2006 8:35:40 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Oct 4, 2006 8:35:40 PM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Oct 4, 2006 8:35:40 PM org.hibernate.cfg.Configuration getConfigurationInputStre
am
INFO: Configuration resource: /hibernate.cfg.xml
Exception in thread "main" org.hibernate.HibernateException: /hibernate.cfg.xml
not found
at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java
:147)
at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configura
tion.java:1287)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1309)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
at test.main(test.java:10)

[console output]
 
Sudhakar Reddy Kurakula
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See,

We can work with out hibernate.properties but not without out hibernate.cfg.xml

Cheers
Sudhakar reddy(SCJP1.4)
9989223696.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic