Realised the term is TableGenerator, not KEY_SEQUENCE, for the issue that is
causing problems here.
I narrowed it down to H2. With Mysql, there is no problem.
Adam Hardy on 15/01/08 11:55, wrote:
> Doing a project with no dependency on any one database vendor, I am
> using KEY_SEQUENCE tables to manage my primary keys. This was working
> fine until I introduced a schema name. Now I get the following exception:
>
> org.apache.openjpa.lib.jdbc.ReportingSQLException: Table DEV not found;
> SQL statement:
> SELECT LAST_KEY FROM DEV.DEV.KEY_SEQUENCE WHERE TABLE_SEQ = ? FOR UPDATE
> [42S02-64] {SELECT LAST_KEY FROM DEV.DEV.KEY_SEQUENCE WHERE TABLE_SEQ =
> ? FOR UPDATE} [code=42102, state=42S02]
>
>
> My schema name is DEV and OpenJPA has prefixed it onto the table name
> twice! I configure the schema name via the database connection
> parameters, e.g.
>
> openjpa.jdbc.Schema=DEV
>
> This is my KEY_SEQUENCE config if it helps:
>
> <table-generator name="codeKeySequence" table="KEY_SEQUENCE"
> pk-column-name="TABLE_SEQ" value-column-name="LAST_KEY"
> pk-column-value="CODE">
> </table-generator>
>
> This is happening in both OpenJPA v 1.0.1 and 1.1.0. I'll have to look
> into this further now to see if it is a problem just with the
> org.apache.openjpa.jdbc.sql.H2Dictionary that I am using.
>
> Does anyone have key sequence tables in a named schema working in any
> database?
>
>
> Thanks
> Adam
>
|