Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
3.01
Mapping documents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="Object1" table="Object1">
<id name="id" column="ID">
<generator class="increment"/>
</id>
<property name="property1"/>
<property name="property2"/>
<property name="property3"/>
<property name="property4"/>
<property name="property5"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
SessionFactory sessionFactory =
new Configuration().configure().buildSessionFactory();
Session session = sessionFactory.getCurrentSession();
session.beginTransaction();
Object1 object1 = new Object1();
object1.setProperty1("Value1");
object1.setProperty2("Value2");
object1.setProperty3("Value3");
object1.setProperty4("Value4");
object1.setProperty5("Value5");
session.save(object1);
session.getTransaction().commit();
Full stack trace of any exception that occurs:
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
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(Configuration.java:1287)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1309)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1296)
at examples.PersistenceTest.main(PersistenceTest.java:22)
Name and version of the database you are using:
Derby 10.1
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Hi, I don't succeed to start with hibernate.
I had write this simple program and I had put hibernate.cfg.xml in the same directory of source and class file.
The result is: HibernateException: /hibernate.cfg.xml not found
Can you help me?
Thank You so much