| Summary: | HSQLDB support for IDENTITY columns doesn't work | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | David Green <greensopinion> |
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P2 | CC: | tom.ware |
| Version: | unspecified | Flags: | tom.ware:
iplog+
|
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | submitted_patch | ||
Workaround is to subclass HSQLPlatform and provide the changed logic and then enable it in your persitence unit with the eclipselink.target-database persistence unit property. (In reply to comment #1) > Workaround is to subclass HSQLPlatform and provide the changed logic and then > enable it in your persitence unit with the eclipselink.target-database > persistence unit property. Thanks Tom, that's what I did and it works for me. Setting target and priority. See the following page for the meanings of these fields: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines Community: Please vote for this bug if it is important to you. Votes are one of the main criteria we use to determine which bugs to fix next. It's hard to believe that a fix as trivial as removing a single character (the comma) is worthy of voting. Strange... From: http://hsqldb.org/doc/guide/ch02.html Under the heading "Identity Auto-Increment Columns" "The supported form is(<colname> INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH n, [INCREMENT BY m])PRIMARY KEY, ...)." The doc is claming a comma is correct. FYI: I am getting the same result as you when I actually create a table in the SQL console. I wonder if this is a bug in HSQL, or in the HSQL doc. Checked-in fix based on my experience of what works despite conflicting documentation. Tested Manually Review: Reviewed User-submitted fix Thanks! The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
HSQLPlatform incorrectly formulates HSQL IDENTITY clause as follows: pre. GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) this results in the following error: pre. Internal Exception: java.sql.SQLException: unexpected token: , required: ) Error Code: -5581 removing the comma after "START WITH 1" fixes the problem: pre. GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1) thus the HSQLPlatform class should be modified as follows: bc. @Override public void printFieldIdentityClause(Writer writer) throws ValidationException { try { writer.write(" GENERATED BY DEFAULT AS IDENTITY (START WITH 1 INCREMENT BY 1)"); } catch (IOException ex) { throw ValidationException.fileError(ex); } } related to task 240467 and task 297198