[hibernate-dev] HHH-2403 - import.sql improvement

Łukasz Antoniak lukasz.antoniak at gmail.com
Mon Nov 7 11:32:33 EST 2011

Thanks Steve for your replay.

The whole idea of supporting multiline statements is that users would
like to execute the scripts they already have (and for example execute
in SQL*Plus for production) without applying extra modifications. The
"continuation" symbol/operator would be useless for them.

I think that introducing an interface like ImportSqlCommandExtracter,
and providing two implementations (single line - the default for
compatibility; and multiline - new) that can be switched by setting
appropriate configuration parameter, would be a good idea. Do you

I hope I didn't make you very angry with my suggestion. Just wanted to
help/contribute and move forward the issue that six people voted for
and exists unresolved since version 3.2. Max agreed that forcing ';'
ending can be done in 3.3 version ("if we break every existing
hibernate 3.2.x users existing import.sql it is not something we can
put in. Then it would wait for 3.3.x." - JIRA HHH-2403). I will keep
in mind that backwards compatibility is the priority.

Best regards,
Lukasz Antoniak

W dniu 7 listopada 2011 16:43 użytkownik Steve Ebersole
<steve at hibernate.org> napisał:
> No!  That is not a good idea.  It introduces unnecessary loss of backwards
> compatibility.
> Another option that is backwards compatible is to instead handle multi-line
> commands specially by introducing a "continuation" symbol/operator.  Think
> `\` on *nix.  The idea being that a line ending with '\' is considered to
> continue on the next line.
> A more generic solution would be to introduce a contract for splitting up
> import.sql files into commands.  Something like:
> interface ImportSqlCommandExtracter {
>   public String[] extractCommands(InputStreamReader streamReader);
> }
> We could even supply 2 impls, one for "required semicolon as separator" and
> another for "continuation symbol".  And allow users to develop and supply
> their own for other situations.
> On Sun 06 Nov 2011 06:57:12 AM CST, Łukasz Antoniak wrote:
>> Welcome!
>> Last time I have been trying to improve the way that Hibernate extracts
>> statements from "import.sql" script. My intention was to support
>> multiline SQL instructions (HHH-2403), quoted strings, multiline
>> comments etc. After developing quite simple ANTLR-based parser, I have
>> realized that right now semicolons are not mandatory (at the end of each
>> SQL statement). If there is no separator character (e.g. ';') between
>> statements, the only possibility to resolve HHH-2403 is to apply a full
>> SQL parser. But supporting all different dialects would be quite
>> difficult... Is it acceptable to change the code, so that each statement
>> must be ended with a semicolon (branch 4.0)?
>> You can see my work here:
>> https://github.com/lukasz-antoniak/hibernate-core/commit/c11b881a8975502fa7b754391d10e789eaa101e6
>> Regards,
>> Lukasz Antoniak
>> _______________________________________________
>> hibernate-dev mailing list
>> hibernate-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
> --
> steve at hibernate.org
> http://hibernate.org

More information about the hibernate-dev mailing list