Hi,

H2 doesn't currently support adding multiple constraints within one
statement. Each constraint must be declared within its own statement.

I guess the statement was generated by Hibernate, specially for the MySQL
dialect.

To work around this problem, you can either create the constraints
manually, patch H2 to support multiple constraints within one statement
(patches are always welcome), or use the H2 dialect instead.

Regards,
Thomas



On Monday, April 30, 2012, Peter Voss wrote:

> Hi,
>
> the manual suggest to use MySQLDialect for Hibernate when running H2
> in mysql compatibility mode. But that would be equivalent to running
> mysql without foreign keys. I have also tried to use
> MySQL5InnoDBDialect, but on start-up of my application I get errors
> like this:
>
> ERROR [2012-04-30 09:51:40] (SchemaUpdate.java:213) - Syntax error in
> SQL statement "ALTER TABLE SHEET ADD INDEX FK6855D5FE28A19C6
> (FILTER_FK),[*] ADD CONSTRAINT FK6855D5FE28A19C6 FOREIGN KEY
> (FILTER_FK) REFERENCES FILTER (ID) "; SQL statement:
> alter table sheet add index FK6855D5FE28A19C6 (filter_fk), add
> constraint FK6855D5FE28A19C6 foreign key (filter_fk) references filter
> (id) [42000-165]
>
> The application still starts, but I don't have any foreign key checks.
> I can delete entities that are referenced by other entities.
>
> Am I doing something wrong? Or is this a bug or feature that will get
> implemented sometime later?
>
> Thanks,
> Peter
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To post to this group, send email to 
> [email protected]<javascript:;>
> .
> To unsubscribe from this group, send email to
> [email protected] <javascript:;>.
> For more options, visit this group at
> http://groups.google.com/group/h2-database?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to