Results 1 to 3 of 3

Thread: Problem using MySQL and Hibernate

  1. #1
    Join Date
    Mar 2005
    Posts
    4

    Default 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 -

    Thanks
    Ratheesh

  2. #2
    Join Date
    Aug 2004
    Location
    San Mateo, CA
    Posts
    1,265

    Default

    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.
    Rod Johnson - GM, SpringSource Division, VMware
    http://www.springsource.com
    Spring From the Source

  3. #3
    Join Date
    Mar 2005
    Posts
    4

    Default

    Silly one. hibernate.hbm2ddl.auto was set to "create" !

Similar Threads

  1. Replies: 6
    Last Post: Jan 11th, 2010, 11:17 PM
  2. Replies: 2
    Last Post: Jan 27th, 2005, 03:52 PM
  3. Newbie. Hibernate + MySQL
    By abstraction in forum Data
    Replies: 6
    Last Post: Oct 24th, 2004, 10:41 PM
  4. Transaction problems with Hibernate and MySQL
    By juanmanuel32 in forum Data
    Replies: 4
    Last Post: Sep 4th, 2004, 07:01 PM
  5. Transaction pb Hibernate/MySQL
    By syluser in forum Data
    Replies: 2
    Last Post: Aug 28th, 2004, 02:40 PM

Posting Permissions

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