db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobb <torb...@ifi.uio.no>
Subject Derby + hibernate & import.sql
Date Sat, 27 Nov 2010 16:13:17 GMT

Hi.

I have a strange problem with Hibernate and Apache Derby. I am trying to
load the import.sql file and run it against a Derby db. My hibernate.cfg.xml
file looks like this:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
	"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
	"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
	
<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>

When i run the program, it creates a new database called safetyinformation,
so far so good.

But when trying to load import.sql, i get the following error:

org.hibernate.JDBCException: Error during import script execution at line 1
	at
org.hibernate.tool.hbm2ddl.SchemaExport.importScript(SchemaExport.java:370)
	at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:276)
	at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:219)
	at
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:370)
	at
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1842)
	at
no.simula.modelme.safetyinformation.safetyinformation.App.main(App.java:22)
Caused by: java.sql.SQLSyntaxErrorException: Syntax error: Encountered
"<EOF>" at line 1, column 24.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown
Source)
	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
	at
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown
Source)
	at
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown
Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown
Source)
	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown
Source)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
	at
org.hibernate.tool.hbm2ddl.SchemaExport.importScript(SchemaExport.java:366)
	... 5 more
Caused by: java.sql.SQLException: Syntax error: Encountered "<EOF>" at line
1, column 24.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
Source)
	at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
Source)
	... 14 more
Caused by: ERROR 42X01: Syntax error: Encountered "<EOF>" at line 1, column
24.
	at org.apache.derby.iapi.error.StandardException.newException(Unknown
Source)
	at org.apache.derby.impl.sql.compile.ParserImpl.parseStatement(Unknown
Source)
	at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
	at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
	at
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown
Source)
	... 8 more

As far as i can tell, this implies some syntax error in the import.sql (had
a few syntax errors, which gave the same message).

The strange thing is, that if i load the import.sql file manually, using
Derbys ij prompt, it loads without error, even in the Derby db created by
Hibernate. 

Is there some part of Hibernates config that i'm missing here?

- Tobb
-- 
View this message in context: http://old.nabble.com/Derby-%2B-hibernate---import.sql-tp30319162p30319162.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Mime
View raw message