Announcement Announcement Module
No announcement yet.
populate database with import.sql file and hibernate Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • populate database with import.sql file and hibernate

    I have put an import.sql file — exported from my MySQL DB — in the root of my project and have these settings in Persistence.xml
    <property name="" value="create"/>
    . I have also tried the META-INF directory.

    What else do I have to do in order to populate my DB before I run my integration tests as well as on deploy? As it is now nothing seems to happen and my DB is empty. I can import the file by hand, but I need this done automatically.
    Last edited by MiB; Dec 20th, 2011, 02:37 PM.

  • #2
    You need hibernate.hbm2ddl.import_files property

    With Hibernate 3.6 you need to set hibernate.hbm2ddl.import_files in order to list the files with SQL DML statements you want to execute during SessionFactory creation.

    <property name="hibernate.hbm2ddl.import_files" value="/file1.sql,/file2.sql"/>
    I didn't try it, its in the Hiberante Core documentation in the last table in Optional Configuration Properties


    • #3
      Thank you. I will try this. Hibernate works so effective in Spring Roo as to be almost invisible and I've forgotten to read up on the developments.