Results 1 to 4 of 4

Thread: Data lost after inserting the record.

  1. #1
    Join Date
    Aug 2007
    Posts
    6

    Default Data lost after inserting the record.

    Hello friends,

    We started a new project and we use Struts, Springs and Hibernate. I have a problem with inserting data in my SQL server. When i hit the save button the records get inserted (in 11 tables). But when i restart my tomcat server data inserted in 8 tables lost. i.e gets deleted. Still i didn't use transactions. We are using two techniques here.
    1. We write a common DAO implementation. For each bean we have dao interface but have only one implmentation class for all beans.
    2. We delegate action management to Springs.

    Thank you,

    Regards,
    K.Siva

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    Check your Hibernate configuration, you probably have the property createSchema set (or use another setting to enable automatic creation of your database schema).
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Aug 2007
    Posts
    6

    Default

    Thank you. In my xml file now i removed this line

    <prop key="hibernate.hbm2ddl.auto">create</prop>

    and its working. Actually we are creating pojos from tables. ie. reverse engineering.

    Could you help me how to use transaction is this scenerio (using common dao and delegate actions to spring)

    Thanks for your help.

  4. #4
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    I would recommend having a read of the reference manual chapter on transactions and having a look at the samples that ship with Spring.
    http://www.springframework.org/docs/...on-declarative
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •