Reputation: 1957
Can't find a solution in SO, so I'm trying to findout how to accomplish the goal here. I've a SqlServer 2014 db which accepts and runs fine a script (which does lots of things, mainly check if exist procedures, drop then, build them, run them and drop them... ).
For example this simple statement:
SET NOCOUNT ON;
IF OBJECT_ID ( 'InitializeProc', 'P' ) IS NOT NULL
DROP PROCEDURE InitializeProc ;
GO
Gives me:
HHH000388: Unsuccessful: IF OBJECT_ID ( 'InitializeProc', 'P' ) IS NOT NULL ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 267) Incorrect syntax near 'NULL'.
I've tried to run my script in the create ddl-auto phase declared in persistence.xml and the sql driver in Hibernate declarations is "SQLServer2012Dialect".
I'm on Java 1.8 - Jboss 7 EAP and jpa 2.1 environment. I've already replace End of line "LF" with "CRLF". Since the script is very long I'm trying to figure out this problem hoping this could be the key to solve whole case.
I know I can simple call the Drop but first of all is ugly and second I found same problem for the rest in other occasions such as "AS", "GO"...an so on.
thanks!
EDIT: If I put all the statement in a single line worked. But It is really ugly to oblige developer to do that. Tried also this in persistence.xml:
<property name="hibernate.hbm2ddl.import_files_sql_extractor" value="org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor" />
...but:
Caused by: org.hibernate.hql.internal.antlr.SqlStatementParser$StatementParserException: line 1:129956: expecting STMT_END, found 'null'
Can't believe such a simple thing can't be done easily. There must be a way.
Upvotes: 2
Views: 994
Reputation: 71
Sorry for necroposting, but I've got the same error with MultipleLinesSqlCommandExtractor ( expecting STMT_END, found 'null') and found the way to solve it - last statement should be ended with ; without exceptions for any kind of delimiters or comments.
Seems like a bug for 5.3.1.Final
Upvotes: 3