-->
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.  [ 3 posts ] 
Author Message
 Post subject: import.sql: Indeed only one liners allowed?
PostPosted: Thu May 20, 2010 3:19 am 
Newbie

Joined: Wed May 19, 2010 11:03 am
Posts: 3
Hi
I have tables whith dozens of fields which I want to populate during deploy using hbm2ddl create-drop.
I naturally ordered such complex insert statements into several lines. The effect was that the SchemaExport.importScript throws the error "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1". I struggled now several hours to find what's going wrong, since executing such a insert statement in the MySQLQueryBrowser showed no problem.
Finally, when stepping through the source-Code, I found that this method (SchemaExport.importScript) executes line by line, regardless if the statements are delimited by ';' like one would expect for sql scripts.
Is there a way to configure the hbm2ddl tool in order that it recognizes multiline statements and executes them correctly? If not I would consider that as a must have for a next version. (Because writing and - especially - maintaining insert statements with dozens of fields within one line is not a real option.)
Tks
Heri


Top
 Profile  
 
 Post subject: Re: import.sql: Indeed only one liners allowed?
PostPosted: Fri May 21, 2010 1:44 pm 
Beginner
Beginner

Joined: Thu Jun 21, 2007 9:24 pm
Posts: 20
Location: Lansing, Michigan, USA
Not to downplay the seriousness of such a limitation, but: isn't the purpose of hbm2ddl to avoid writing a lot of custom SQL? If you're writing the whole "CREATE TABLE" statement out by hand anyway, just put in a .sql file or in an Ant SQL task.


Top
 Profile  
 
 Post subject: Re: import.sql: Indeed only one liners allowed?
PostPosted: Tue May 25, 2010 2:54 am 
Newbie

Joined: Wed May 19, 2010 11:03 am
Posts: 3
davidl2 wrote:
Not to downplay the seriousness of such a limitation, but: isn't the purpose of hbm2ddl to avoid writing a lot of custom SQL? If you're writing the whole "CREATE TABLE" statement out by hand anyway, just put in a .sql file or in an Ant SQL task.


I'm not talking of create-statements, but insert-statements for an initial fill with test data.
What you mean by "just put in a .sql file"?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.