| Summary: | Using @Index annotation on an entity field fails on PostGres (looks like setField not being called), on getter fails to generate index | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | wayne townsend-merino <townsendmerino> |
| Component: | Eclipselink | Assignee: | Project Inbox <eclipselink.orm-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P2 | CC: | syvalta, tom.ware |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | Macintosh | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | postgresql | ||
Setting target and priority. See the following page for the meanings of these fields: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines Occurs also with hsql 2.0.0. [EL Warning]: 2011-03-02 12:46:45.715--ServerSession(1006157069)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: unexpected token: ) Error Code: -5581 Call: CREATE INDEX INDEX_FOO_ ON FOO () Query: DataModifyQuery(sql="CREATE INDEX INDEX_FOO_ ON FOO ()") It seems SQL generated for Oracle fails too: Error: ORA-00936: missing expression SQLState: 42000 ErrorCode: 936 Position: 256 Error occured in: CREATE INDEX INDEX_FOO_ ON FOO () One more addition: it seems that the default field name causes the problem. So this works: @Index @Column(name="something") int something; And this too: @Index(columnNames="something") int something; But the most common one with default name does not: @Index int something; Seems to apply for all platforms. This seem to be working in 2.3.0. Setting to fixed based on above comment. The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
Build Identifier: 2.2 @Entity @Table(name = "dt_samples", schema = "kb") public class Sample extends AbstractKbEntity { private static final long serialVersionUID = 1L; @Column(length = 50) @Index private String timeUnits; generates: [EL Info]: 2011-01-12 16:31:52.929--ServerSession(139291418)--EclipseLink, version: Eclipse Persistence Services - 2.2.0.qualifier [EL Info]: 2011-01-12 16:31:53.08--ServerSession(139291418)--file:/Users/tmAir/LBL/work_kb/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/kbweb/WEB-INF/classes/_kbweb login successful [EL Warning]: 2011-01-12 16:31:53.246--ServerSession(139291418)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.0.qualifier): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: org.postgresql.util.PSQLException: ERROR: index "index_dt_samples_" does not exist Error Code: 0 Call: DROP INDEX INDEX_dt_samples_ Query: DataModifyQuery(sql="DROP INDEX INDEX_dt_samples_") [EL Warning]: 2011-01-12 16:31:53.306--ServerSession(139291418)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.0.qualifier): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: org.postgresql.util.PSQLException: ERROR: syntax error at or near ")" Position: 50 Error Code: 0 Call: CREATE INDEX INDEX_dt_samples_ ON kb.dt_samples () Query: DataModifyQuery(sql="CREATE INDEX INDEX_dt_samples_ ON kb.dt_samples ()") ------- Also, using this: @Index public String getTimeUnits() { return timeUnits; } fails to generate an index in the DDL Reproducible: Always Steps to Reproduce: 1.Use @Index annotation on a field or getter 2. 3.