-->
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.  [ 3 posts ] 
Author Message
 Post subject: hibernate.cfg.xml being loaded when using hibernate.properti
PostPosted: Mon Nov 10, 2003 11:58 pm 
Newbie

Joined: Mon Nov 10, 2003 11:51 pm
Posts: 2
All, I am a total newbie. I am using 2.0.3. I am tryin to run a test case from Intellij to test my first class/mapping. I have configured hibernate.properties and it IS in the classpath. For some reason configure() is also trying to load hibernate.cfg.xml. I tried searching on the forums and FAQ but could not find anyone with this problem. The following is the log4j trace and the src code after that.

Please help
Steve

.0 [main] INFO net.sf.hibernate.cfg.Environment - Hibernate 2.0.3
41 [main] INFO net.sf.hibernate.cfg.Environment - loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=org.gjt.mm.mysql.Driver, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.jdbc.batch_size=0, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.query.imports=com.gx.persistence.artist, hibernate.proxool.pool_alias=pool1, hibernate.connection.username=root, hibernate.connection.url=jdbc:mysql://localhost/music, hibernate.show_sql=false, hibernate.statement_cache.size=25, hibernate.connection.pool_size=1}
51 [main] INFO net.sf.hibernate.cfg.Environment - using java.io streams to persist binary types
61 [main] INFO net.sf.hibernate.cfg.Environment - using CGLIB reflection optimizer
61 [main] INFO net.sf.hibernate.cfg.Environment - JVM proxy support: true
131 [main] INFO net.sf.hibernate.cfg.Configuration - Mapping resource: com/gx/persistence/artist/Artist.hbm.xml
321 [main] DEBUG net.sf.hibernate.util.DTDEntityResolver - trying to locate http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
381 [main] DEBUG net.sf.hibernate.util.DTDEntityResolver - found http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
792 [main] INFO net.sf.hibernate.cfg.Binder - Mapping class: com.gx.persistence.artist.Artist -> Artist
1022 [main] DEBUG net.sf.hibernate.cfg.Binder - Mapped property: id -> artist_id, type: integer
1072 [main] DEBUG net.sf.hibernate.cfg.Binder - Mapped property: name -> artist_name, type: string
1072 [main] INFO net.sf.hibernate.cfg.Configuration - Configuration resource: /hibernate.cfg.xml
1082 [main] WARN net.sf.hibernate.cfg.Configuration - /hibernate.cfg.xml not found
E

Source:
Code:
protected void setUp() throws Exception {
        Configuration config = new Configuration();
     
        config.addClass(Artist.class);
        config.configure();
     }


Top
 Profile  
 
 Post subject: Please ignore
PostPosted: Tue Nov 11, 2003 12:02 am 
Newbie

Joined: Mon Nov 10, 2003 11:51 pm
Posts: 2
I was calling
factory = config.configure().buildSessionFactory();

instead of
factory = config.buildSessionFactory();


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 11, 2003 6:29 am 
Expert
Expert

Joined: Tue Sep 16, 2003 4:06 pm
Posts: 318
Location: St. Petersburg, Russia
See sources

Code:
   public Configuration configure() throws HibernateException {
      configure("/hibernate.cfg.xml");
      return this;
   }


For me it was better to stop using .properties file and move to .xml completely


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