i am learning hibernate at the first time then following example on the Hibernate in Action book.
i create a test class that create hibernate session but i seem that the hibernate could not locate the hibernate.properties how could i fix the problem?
the following is code
package hello;
import net.sf.hibernate.*;
import net.sf.hibernate.cfg.Configuration;
public class test {
public static void main(String[] argv) {
try {
SessionFactory sessions = new Configuration()
.addClass(hello.Message.class)
.buildSessionFactory();
Session session = sessions.openSession();
Transaction tx = session.beginTransaction();
Message message = new Message("Hello World");
session.save(message);
// System.out.println(message.getText());
} catch (Exception e) {e.printStackTrace();}
}
}
then the following is log
C:\myjava\hibernate>echo %classpath%
C:\myjava\hibernate
C:\myjava\hibernate>dir *.properties
Volume in drive C has no label.
Volume Serial Number is 9CA0-051B
Directory of C:\myjava\hibernate
01/26/2005 03:13 PM 420 hibernate.properties
01/26/2005 09:07 AM 411 log4j.properties
2 File(s) 831 bytes
0 Dir(s) 8,397,676,544 bytes free
C:\myjava\hibernate>java -cp . hello.test
15:32:59,320 INFO Environment:478 - Hibernate 2.1.7
15:32:59,330 INFO Environment:507 - hibernate.properties not found
15:32:59,330 INFO Environment:538 - using CGLIB reflection optimizer
15:32:59,330 INFO Environment:567 - using JDK 1.4 java.sql.Timestamp handlin
g
15:32:59,340 INFO Configuration:350 - Mapping resource: hello/Message.hbm.xm
l
15:33:00,001 INFO Binder:230 - Mapping class: hello.Message -> MESSAGE
15:33:00,111 INFO Configuration:632 - processing one-to-many association map
pings
15:33:00,111 INFO Configuration:641 - processing one-to-one association prop
erty references
15:33:00,111 INFO Configuration:666 - processing foreign key constraints
15:33:00,131 WARN SettingsFactory:53 - No dialect set - using GenericDialect
: The dialect was not set. Set the property hibernate.dialect.
15:33:00,141 INFO Dialect:86 - Using dialect: net.sf.hibernate.dialect.Gener
icDialect
15:33:00,151 INFO SettingsFactory:74 - Use outer join fetching: true
|