Announcement Announcement Module
No announcement yet.
Problem using MySQL and Hibernate Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem using MySQL and Hibernate

    My App's persistence strategy is :

    Spring/HibernateDAOSupport -> Hibernate -> MySQL.

    I have a simple test case which adds a row to a table.

    BUT, somehow, this test case manages to delete all the existing rows while inserting the new one !!

    Any idea whats going wrong ? Of course, I don't want to loose my existing rows -


  • #2
    Please start by configuring Hibernate to show the SQL it's generating. The relevant property is hibernate.show_sql and it should be set to true. You will do this either in the hibernate properties in the LocalSessionFactoryBean bean definition where you configure Hibernate in Spring, or in a separate properties file if you've pulled it out. See applicationContext-hibernate.xml in the PetClinic sample app shipped with Spring for an example.

    If the SQL is incorrect, it's probably a Hibernate mappings or usage issue. If the SQL looks correct, please post (edited) configuration and Java code.


    • #3
      Silly one. was set to "create" !