File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Session onject throwing exception when trying to save a object or begin a transaction Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "Session onject throwing exception when trying to save a object or begin a transaction" Watch "Session onject throwing exception when trying to save a object or begin a transaction" New topic
Author

Session onject throwing exception when trying to save a object or begin a transaction

venkatPrasad Regula
Greenhorn

Joined: Sep 28, 2010
Posts: 26

I have written a simple hibernate code to save an object. When I type session.save(0 or session.beginTransaction(), it is throwing an exception. My code is given below



The output is
venkatPrasad Regula
Greenhorn

Joined: Sep 28, 2010
Posts: 26
Same thing is happening if I try to start a Transaction too.

Samrat Gadamsetty
Greenhorn

Joined: Feb 10, 2011
Posts: 29
Can you show us the mapping and hibernate configuration file?
venkatPrasad Regula
Greenhorn

Joined: Sep 28, 2010
Posts: 26
Hibernate Mapping File



Hibernate Cfg file

venkatPrasad Regula
Greenhorn

Joined: Sep 28, 2010
Posts: 26
If I try the example given on RoseIndia website it is working. I am really not able to identify what the fault is.
Samrat Gadamsetty
Greenhorn

Joined: Feb 10, 2011
Posts: 29
print the exception full stack trace and see you can find anything useful...
venkatPrasad Regula
Greenhorn

Joined: Sep 28, 2010
Posts: 26


I started the server too
Server info displayed is

root
localhost
/var/run/mysqld/mysqld.sock

MySQL 5.1.41-3ubuntu12.6
localhost
127.0.0.1
Samrat Gadamsetty
Greenhorn

Joined: Feb 10, 2011
Posts: 29
Change the code in ( probably it may work..I'm not sure..)

SessionFactory sessionFactory=new Configuration().configure("hibernate.cfg.xml").buildSessionFactory();
and run with exception full stack trace...
we hope the best..
venkatPrasad Regula
Greenhorn

Joined: Sep 28, 2010
Posts: 26
The issue got resolved as I placed an higher version of mysql jar file
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session onject throwing exception when trying to save a object or begin a transaction
 
Similar Threads
Hibernate
Problem with running my first Hibernate App
hibernate sample done but no record inserted
Exception in thread "main" org.hibernate.exception.GenericJDBCException: Cannot open connection
NullPointerException in creating Session Object using Hibernate