0

I'm running a Hibernate configuration (No JPA) and have inserted a test set using random name generators (for practice with the Criteria API), but on ever startup, hibernate keeps clearing out the test set, forcing me to regenerate it. Is there any way to disable this feature? I'm running only bare-bones (connection and mappings) hibernate configuration.

EDIT (hibernate.cfg.xml):

<property name="hibernate.dialect" >org.hibernate.dialect.MySQLDialect</property>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.url" >jdbc:mysql://localhost:3306/testdb?zeroDateTimeBehavior=convertToNull</property>
    <property name="hibernate.connection.username" >Sarah</property>
    <property name="hibernate.connection.password"></property>
Neil Stockton
  • 11,383
  • 3
  • 34
  • 29
Sarah Szabo
  • 10,345
  • 9
  • 37
  • 60

1 Answers1

0

Ok, so actually adding <property name="hibernate.hbm2ddl.auto">validate</property> seemed to work. I guess hibernate.hbm2ddl.auto must have a default value.

Sarah Szabo
  • 10,345
  • 9
  • 37
  • 60
  • Strange, should not be necessary. If you do not add that option Hibernate should not make any changes to the database. There is no official `do-nothing` parameter: http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch03.html#configuration-optional, see also http://stackoverflow.com/questions/3179765/how-to-turn-off-hbm2ddl – Matthias Herlitzius Apr 24 '15 at 07:47