Hi Lukas Thanks for investigating further.
For what it's worth, it actually seems like the IGNORECASE setting makes no difference here; it's only MODE=MySQL that causes the case to be different. Running the query for constraints with case-sensitivity on (H2 default) produces the following results: URL: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;MODE=MySQL Outputs: public,consultant,CONSULTANTID,constraint_1 URL: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 Outputs: PUBLIC,CONSULTANT,CONSULTANTID,CONSTRAINT_1 According do the H2 documentation about MySQL Compatibility Mode, The fact that *"Meta data calls return identifiers in lower case"* is by design: http://h2database.com/html/features.html#compatibility Therefore, it seems to me that jOOQ cannot assume the case of meta data when using H2 because, as far as I can see, there's no way of jOOQ's code generator knowing whether or not the underlying database is in compatibility mode. In fact, even if you could determine compatibility mode, it's probably not wise to dabble in such a thing. If the column list does disappear and a better way to join indexes and constraints is established then this might solve the problem but, if not, would it still not be reasonable to use case-insensitivity for code generation against H2? Cheers, Adam On Tuesday, 11 February 2014 17:36:34 UTC, Adam wrote: > > Hi, > > I've been experimenting with jOOQ and, first of all, I have to say I'm > very impressed so far. There just seems to be one snag that I've > encountered regarding using H2's in-memory database alongside the jOOQ code > generator, in that it only generates org.jooq.impl.TableRecordImplclasses for > all tables rather than updatable records. > > The output from the code generator prints things like this: > > Feb 11, 2014 5:16:54 PM org.jooq.util.DefaultRelations info > INFO: Ignoring primary key : constraint_4(column unavailable) > Feb 11, 2014 5:16:54 PM org.jooq.util.DefaultRelations info > INFO: Ignoring primary key : constraint_47(column unavailable) > > On closer inspection, it seems that the column is unavailable because the > code in org.jooq.util.h2.H2Database#loadPrimaryKeys is failing to extract > the primary key ColumnDefinition from its table by column name: > > 1 TableDefinition table = getTable(schema, tableName); > 2 if (table != null) { > 3 String[] columnNames = columnList.split("[,]+"); > 4 > 5 for (String columnName : columnNames) { > 6 relations.addPrimaryKey(primaryKey, > table.getColumn(columnName)); > 7 } > 8 } > > The column name is coming in upper case but this doesn't agree with the > TableDefinition. If I change the call to table.getColumn(columnName)(line 6 > above) to be table.getColumn(columnName, > true) then it works perfectly and generates updatable table records as > I'd expect. > > I've had to extend the H2Database class and override the > loadPrimaryKeysmethod to fix this, but, given that nobody else seems to have > this problem, > I can't help feeling I'm missing something and there must be a better way > to handle this case-sensitivity issue. Is there a less cumbersome way to > get code generation to work with H2 or is this actually a bug? > > Many thanks, > > Adam > > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
