5
Hello I’m having a difficulty regarding a Hibernate configuration hibernate.hbm2ddl.import_files
i believe q am doing everything right to find the sql path, I am using the same to insert some data into a tables as soon as the database is created
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost/usuarios" ></property>
<property name="javax.persistence.jdbc.user" value="postgres" />
<property name="javax.persistence.jdbc.password" value="" />
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="hibernate.connection.shutdown" value="true" />
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="hibernate.hbm2ddl.import_files" value="/resources/sql/init.sql"/>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true"/>
this init.sql is in the web/WEB-INF/Resources/sql/init.sql folder (default Maven)
I managed to do it this way: I put persistence src/main/resource/META-INF/sql/dados.sql
and the Presoperty were as follows
<property name="hibernate.hbm2ddl.import_files" value="META-INF/sql/dados.sql"/>
<property name="hibernate.hbm2ddl.auto" value="create"/>
persistence is in the Resource folder