aspose file tools*
The moose likes Object Relational Mapping and the fly likes Data getting saved in session, but not being persisted in table. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Data getting saved in session, but not being persisted in table." Watch "Data getting saved in session, but not being persisted in table." New topic
Author

Data getting saved in session, but not being persisted in table.

mara thamizhan
Ranch Hand

Joined: Jul 05, 2006
Posts: 74
Dear dudes,
In persisting data in MySQL through hibernate, i'm using a simple java class , which creates an instance of my form , sets data , reads the configuration file, builds a session factory i.e. hibernate.cfg.xml , opens the session and save data .
Actually data was not inserted into the table eventhough i'm getting the message similar to that.

I created the database in MySQL initially.
message console:


My java application:"Testinghibernate.java"




Information.java


hibernate.cfg.xml:



Information.hbm.xml:
mara thamizhan
Ranch Hand

Joined: Jul 05, 2006
Posts: 74
will someone please reply?
jayachandra madopothula
Greenhorn

Joined: Jan 08, 2008
Posts: 4
Possible corrections you have to have work
1.If you are working in eclipse please check the application structure
2. remove the and run it.
jayachandra madopothula
Greenhorn

Joined: Jan 08, 2008
Posts: 4

see the structure shown in the picture.

after arranging the whole structure just update resource mapping tag in hibernate.cfg.xml with absolute path of the hbm.xml
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Hibernate requires a Transaction, and it to be commited to actually save stuff to the database. I do not see a

Transaction tx = session.beginTransaction();

and I also don't see a

tx.commit();

in your code.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Vikky Bali
Greenhorn

Joined: Jun 07, 2007
Posts: 1
Using Transaction it is working but Is this mandatory to use transaction in Hibernate ?
 
 
subject: Data getting saved in session, but not being persisted in table.
 
Similar Threads
Hibernate
Batch Update Failure
data insert error
where to place hibernate.cfg.xml ?
org.hibernate.exception.GenericJDBCException