-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: import.sql won't load
PostPosted: Mon Nov 22, 2010 11:50 am 
Beginner
Beginner

Joined: Mon Nov 15, 2010 10:39 am
Posts: 27
Hi

I am using Hibernate + Maven + Apache Derby, and creating a .jar file using maven. I can connect to Derby through Hibernate, and create a db with create=true, but it won't input my import.sql file.

My hibernate config looks like this:

<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
<property name="connection.url">jdbc:derby:safetyinformation;create=true</property>
<property name="dialect">org.hibernate.dialect.DerbyDialect</property>
<property name="hibernate.hbm2ddl.auto">create</property>
<property name="hibernate.show_sql">true</property>
</session-factory>
</hibernate-configuration>

I have tried putting the import.sql file in both the same folder as the resulting .jar file, as well as in the src/main/resources folder of the project/ the root of the .jar file. Still, it does not seem that the import.sql file is loaded at all. What can be wrong?

- Tobb


Top
 Profile  
 
 Post subject: Re: import.sql won't load
PostPosted: Mon Mar 28, 2011 10:34 pm 
Newbie

Joined: Sun Mar 20, 2011 10:07 pm
Posts: 1
Hi,
I'm having the exact same problem, import.sql won't load. The database tables are created successfully each time I run my application (within Eclipse Helios). 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>

I have tried removing line breaks, with+without semi colons ";", tested the SQL on the command line (the insert statements work), tried intentionally broken SQL (produces no errors on console). I have tried placing import.sql at the root of my classpath, and also in META-INF (still no luck).

Am I missing something in persistence.xml?

If errors were encountered upon inserting to the MySQL database, where are the errors reported? Eclipse console, or MySQL logs? I haven't looked at MySQL logs yet.

Please help!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.