I wrote files and dirs according to the references. all the files compiled successfully .But when use the ant to build the file. i can't insert data into database ,nor can i query the database.
Once keypressed :ant run -Daction=store
there are many INFO listed ,and at the end together with the failed info :
[java] 15:32:42,531 INFO Configuration:1027 - processing association prope
rty references
[java] 15:32:42,531 INFO Configuration:1049 - processing foreign key const
raints
[java] 15:32:42,562 INFO TableMetadata:40 - table found: sample.events
[java] 15:32:42,578 INFO TableMetadata:41 - columns: [event_id, title, eve
nt_date]
[java] 15:32:42,578 INFO TableMetadata:43 - foreign keys: []
[java] 15:32:42,578 INFO TableMetadata:44 - indexes: [primary]
[java] 15:32:42,578 INFO SchemaUpdate:162 - schema update complete
[java] 15:32:42,578 INFO DriverManagerConnectionProvider:147 - cleaning up
connection pool: jdbc:mysql://localhost:3306/sample
[java] 15:32:42,578 INFO SessionFactoryImpl:432 - Checking 0 named queries
[java] Exception in thread "main" org.hibernate.HibernateException: No Curr
entSessionContext configured!
[java] at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(Sessi
onFactoryImpl.java:602)
[java] at EventManager.createAndStoreEvent(Unknown Source)
[java] at EventManager.main(Unknown Source)
[java] Java Result: 1
i have changed the EventManager.java and HibernateUtil.java according to someother's examples,it can work,but ,i want to use just the example,how to resolve it .thank you .!
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt: