How to download Hibernate import.sql?
Database Tables Created Successfully
<property name="hibernate.hbm2ddl.auto" value="create"/>"
in persistence.xml, however, every time I run my application (in Eclipse Helios), import.sql does not load. My persistence.xml file
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/ ... ce_2_0.xsd" version="2.0">
<persistence-unit name="myPersistenceUnit">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.hbm2ddl.auto" value="create"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.url" value="jdbc:mysql://localhost/svrmonitor4" />
<property name="hibernate.connection.username" value="username" />
<property name="hibernate.connection.password" value="password" />
</properties>
</persistence-unit>
</persistence>
With the contents of import.sql, I tried to remove line breaks, with + without half-columns ";", tested SQL at the command line (insert statements work), tried to deliberately break SQL (does not cause errors on the console). I tried putting import.sql at the root of my classpath, as well as in META-INF (still no luck). I tried to put "USE svrmonitor4;" at the beginning of the import.sql file (again, no luck).
Am I missing something in persistence.xml?
MySQL, ? Eclipse MySQL? MySQL.
Eclipse :
A ( , ) → B → C ( Entity, persistence.xml)
import.sql , .
, Log4J, Hibernate hbm2ddl INFO. import.sql persistence.xml, eclipse. , log4j.xml:
<logger name="org.hibernate.tool.hbm2ddl" additivity="false">
<level value="info"/><appender-ref ref="console" />
</logger>
<logger name="org.hibernate" additivity="false">
<level value="warn"/><appender-ref ref="console" />
</logger>
, Hibernate, .import.sql.
Log4j , SQL import.sql script
, SQL- "INSERT INTO..." ( , Entity , , ).