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 Problem in insert query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Problem in insert query" Watch "Problem in insert query" New topic
Author

Problem in insert query

amishrm sharma
Greenhorn

Joined: Dec 08, 2008
Posts: 7
Hi everyone! I'm developing my first java application using hibernate. I'm stuck with this problem and I can't figure out where's my mistake, so if someone has any idea it would be very helpful.

Basically,my code is properly excuted, but each and every excution time previous data from the table is deleted from the database and new data is inserted into the db. Please suggest me.

i am using Oracle 10g database server.

Please check the below code.
---------------------------------------------------------------------------
in HibernateUtil class
---------------------------------------------------------------------------

---------------------------------------------------------------------------
in DataManger class
---------------------------------------------------------------------------

---------------------------------------------------------------------------
in Mapping file
---------------------------------------------------------------------------


---------------------------------------------------------------------------
in Configuration File Hibernate.cfg.xml
---------------------------------------------------------------------------


--------------------------------------
Best Regards,
Amit Sharma
[ December 17, 2008: Message edited by: Paul Sturrock ]
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


Basically,my code is properly excuted, but each and every excution time previous data from the table is deleted from the database and new data is inserted into the db. Please suggest me.

From your hibernate.cfg.xml:


This means your tables will be removed everytime your restart your application. If you want Hibernate to do DDL stuff, you might consider changing this value to update.
[ December 17, 2008: Message edited by: Paul Sturrock ]

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
amishrm sharma
Greenhorn

Joined: Dec 08, 2008
Posts: 7
Thanks Paul..
it's working now.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in insert query