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.TableRecordImpl classes 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.

Reply via email to