openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <adam....@cyberspaceroad.org>
Subject using a KEY_SEQUENCE table
Date Tue, 15 Jan 2008 11:55:12 GMT
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

Mime
View raw message