2 Replies Latest reply on Aug 15, 2007 4:19 AM by doballve

    import.sql executed twice (I know why but...)

    nicmarti Newbie

      Hi guys

      As you know, you can define an SQL file "import.sql" that gets imported by Hibernate at each application deploy. I add an issue this morning: all my sample entries were imported twice at each deploy...
      I found that the reason was due to a duplicate definition of property hibernate.hbm2ddl.auto in both my hibernate.cfg.xml and persistence.xml file.
      If you set the value to create-drop in both files, the import.sql file is imported twice. To make it work properly I updated the value to "update" in the hibernate.cfg.xml.

      my question is :
      - is this a bug to let the user in Seam do this ? or couldn't we drop a little WARN message just in case of ?

      I also found that persistence.xml is the first one that gets called. hibernate.cfg.xml for my jBPM stuffs is called after all the jbpm init stuffs.
      So maybe the order could be also important if I want to create defaults users in the jbpm part...

      I just want a feed back and your opinion on this.

      Thanks

      Nicolas

      --------------------------------------------------------
      From hibernate doc:


      hibernate.hbm2ddl.auto Automatically validate or export schema DDL to the database when the SessionFactory is created. With create-drop, the database schema will be dropped when the SessionFactory is closed explicitly.

      eg. validate | update | create | create-drop