Two Laptop Bag*
The moose likes Spring and the fly likes Problem in Running Hibernate Sample application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Problem in Running Hibernate Sample application" Watch "Problem in Running Hibernate Sample application" New topic
Author

Problem in Running Hibernate Sample application

DhanunjayReddy Valluru
Greenhorn

Joined: Oct 10, 2009
Posts: 3
Code tag is added. Could you please look into this. Sorry for inconvenience.

HI experts,

I am trying to run the sample hibernate application from www.roseindia.com, but the session.save(object) does not insert the object in the oracle DB.Am not getting any errors or exceptions here is a snippet of the code :



Example given in roseindia:
=================




hibernate.cfg.xml:
===========




contact.hbm.xml:
--------------------


Please help me out to run this application.
Database: oracle10g
JDBC driver version is 10.2.0.1.0


--Regards
Dhanunjay Reddy V

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.

DhanunjayReddy Valluru
Greenhorn

Joined: Oct 10, 2009
Posts: 3
Hi All,

Sample hibernate example in roseIndia is running with out any errors but not saving into the database. Its because they are not starting the transaction. Transacton object you have to get it from session. Once you persist the object, please commit the transaction. That will solve the problem. See the modified code below.





Thanks for all who has looked into this issue.

--Regards
Dhanunjay Reddy V
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in Running Hibernate Sample application
 
Similar Threads
Cannot insert record into Database!
session null
Hibernate exception problem
session.flush(); gives null
org.hibernate.exception.GenericJDBCException