-->
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: HIbernate, derby & import.sql
PostPosted: Sat Nov 27, 2010 12:06 pm 
Beginner
Beginner

Joined: Mon Nov 15, 2010 10:39 am
Posts: 27
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


Top
 Profile  
 
 Post subject: Re: HIbernate, derby & import.sql
PostPosted: Mon Nov 29, 2010 4:52 am 
Beginner
Beginner

Joined: Mon Nov 15, 2010 10:39 am
Posts: 27
Figured it out, appearantly Hibernate does not like line breaks in imported sql files..


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.