DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
Issue Details (XML | Word | Printable)

Type: Task Task
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Andy Jefferson
Reporter: Andy Jefferson
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
DataNucleus Store RDBMS

Derby handling of composite indexes via JDBC is not well-handled

Created: 28/Jun/11 04:08 PM   Updated: 01/Aug/11 05:13 PM   Resolved: 28/Jun/11 05:41 PM
Component/s: Schema
Affects Version/s: None
Fix Version/s: 3.0.0.m6

 Description  « Hide
If we create a unique index across multiple fields, resulting in the following SQL

ALTER TABLE {tblName} ADD CONSTRAINT {constrName} UNIQUE (col1, col2, col3)

and then we call DatabaseMetaData it returns
  tableCat =
  tableSchem = null
  tableName = FIELDMETA
  nonUnique = true
  ordinalPosition = 1
  indexName = SQL110628145704820
  tableCat =
  tableSchem = null
  tableName = FIELDMETA
  nonUnique = true
  ordinalPosition = 2
  indexName = SQL110628145704820
  tableCat =
  tableSchem = null
  tableName = FIELDMETA
  columnName = FIELDNAME
  nonUnique = true
  ordinalPosition = 3
  indexName = SQL110628145704820

so is returning the index as 3 rows of the result set, and as "non-unique"!

MySQL does the same except it uses the actual index name (so we can match it) and puts unique.

Sort Order: Ascending order - Click to sort in descending order
Andy Jefferson added a comment - 28/Jun/11 05:41 PM
Derby adapter changed to generate unique index via