You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Fay Wang (JIRA)" <ji...@apache.org> on 2008/05/20 21:09:55 UTC
[jira] Created: (OPENJPA-605) Informix will throw an exception when
a unique index is explictily created on the primary key columns
Informix will throw an exception when a unique index is explictily created on the primary key columns
-----------------------------------------------------------------------------------------------------
Key: OPENJPA-605
URL: https://issues.apache.org/jira/browse/OPENJPA-605
Project: OpenJPA
Issue Type: Bug
Reporter: Fay Wang
When an entity is defined as following (unique index annotation on the primary key field. In this situation):
@Entity
@Table(name="AddressBean")
public class AddressBeanAno implements IAddressBean, Serializable {
@EmbeddedId
@Index(name="street_index",unique=true)
@Column(length=30)
private AddressPK street;
Informix will issue an error:
Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Index already exists on column. {stmnt 1440372186 CREATE UNIQUE INDEX street_index ON AddressBean (street)} [code=-350, state=S0011]
at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:192)
at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$3(LoggingConnectionDecorator.java:189)
at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:762)
at org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(DelegatingStatement.java:114)
at org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1204)
at org.apache.openjpa.jdbc.schema.SchemaTool.createIndex(SchemaTool.java:1019)
at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:554)
at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:344)
at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:321)
at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:501)
Per Informaix SQL syntax guide (Create Index section):
You can not add a unique index to a column or column list that a primary -key constraint on it. The reason is that defining the column or column list as the primary key causes the database server to create a unique internal index on the column or column list. So you cannot create another unique index on this column or column list with CREATE INDEX statement.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (OPENJPA-605) Informix will throw an exception
when a unique index is explictily created on the primary key columns
Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12598474#action_12598474 ]
Pinaki Poddar commented on OPENJPA-605:
---------------------------------------
The method
public boolean columnsMatch(Column[] ocols)
in LocalConstraint.java may be useful for the logic expressed in the patch.
> Informix will throw an exception when a unique index is explictily created on the primary key columns
> -----------------------------------------------------------------------------------------------------
>
> Key: OPENJPA-605
> URL: https://issues.apache.org/jira/browse/OPENJPA-605
> Project: OpenJPA
> Issue Type: Bug
> Reporter: Fay Wang
> Attachments: openjpa.patch, openjpa.patch
>
>
> When an entity is defined as following (unique index annotation on the primary key field. In this situation):
> @Entity
> @Table(name="AddressBean")
> public class AddressBeanAno implements IAddressBean, Serializable {
> @EmbeddedId
> @Index(name="street_index",unique=true)
> @Column(length=30)
> private AddressPK street;
> Informix will issue an error:
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Index already exists on column. {stmnt 1440372186 CREATE UNIQUE INDEX street_index ON AddressBean (street)} [code=-350, state=S0011]
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:192)
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$3(LoggingConnectionDecorator.java:189)
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:762)
> at org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(DelegatingStatement.java:114)
> at org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1204)
> at org.apache.openjpa.jdbc.schema.SchemaTool.createIndex(SchemaTool.java:1019)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:554)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:344)
> at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:321)
> at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:501)
> Per Informaix SQL syntax guide (Create Index section):
> You can not add a unique index to a column or column list that a primary -key constraint on it. The reason is that defining the column or column list as the primary key causes the database server to create a unique internal index on the column or column list. So you cannot create another unique index on this column or column list with CREATE INDEX statement.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (OPENJPA-605) Informix will throw an exception
when a unique index is explictily created on the primary key columns
Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-605?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Dick reassigned OPENJPA-605:
------------------------------------
Assignee: Catalina Wei (was: Michael Dick)
> Informix will throw an exception when a unique index is explictily created on the primary key columns
> -----------------------------------------------------------------------------------------------------
>
> Key: OPENJPA-605
> URL: https://issues.apache.org/jira/browse/OPENJPA-605
> Project: OpenJPA
> Issue Type: Bug
> Reporter: Fay Wang
> Assignee: Catalina Wei
> Fix For: 1.2.0
>
> Attachments: openjpa.patch, openjpa.patch, openjpa.patch, openjpa.patch
>
>
> When an entity is defined as following (unique index annotation on the primary key field. In this situation):
> @Entity
> @Table(name="AddressBean")
> public class AddressBeanAno implements IAddressBean, Serializable {
> @EmbeddedId
> @Index(name="street_index",unique=true)
> @Column(length=30)
> private AddressPK street;
> Informix will issue an error:
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Index already exists on column. {stmnt 1440372186 CREATE UNIQUE INDEX street_index ON AddressBean (street)} [code=-350, state=S0011]
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:192)
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$3(LoggingConnectionDecorator.java:189)
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:762)
> at org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(DelegatingStatement.java:114)
> at org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1204)
> at org.apache.openjpa.jdbc.schema.SchemaTool.createIndex(SchemaTool.java:1019)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:554)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:344)
> at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:321)
> at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:501)
> Per Informaix SQL syntax guide (Create Index section):
> You can not add a unique index to a column or column list that a primary -key constraint on it. The reason is that defining the column or column list as the primary key causes the database server to create a unique internal index on the column or column list. So you cannot create another unique index on this column or column list with CREATE INDEX statement.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (OPENJPA-605) Informix will throw an exception
when a unique index is explictily created on the primary key columns
Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-605?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Dick reassigned OPENJPA-605:
------------------------------------
Assignee: Michael Dick
> Informix will throw an exception when a unique index is explictily created on the primary key columns
> -----------------------------------------------------------------------------------------------------
>
> Key: OPENJPA-605
> URL: https://issues.apache.org/jira/browse/OPENJPA-605
> Project: OpenJPA
> Issue Type: Bug
> Reporter: Fay Wang
> Assignee: Michael Dick
> Attachments: openjpa.patch, openjpa.patch, openjpa.patch, openjpa.patch
>
>
> When an entity is defined as following (unique index annotation on the primary key field. In this situation):
> @Entity
> @Table(name="AddressBean")
> public class AddressBeanAno implements IAddressBean, Serializable {
> @EmbeddedId
> @Index(name="street_index",unique=true)
> @Column(length=30)
> private AddressPK street;
> Informix will issue an error:
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Index already exists on column. {stmnt 1440372186 CREATE UNIQUE INDEX street_index ON AddressBean (street)} [code=-350, state=S0011]
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:192)
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$3(LoggingConnectionDecorator.java:189)
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:762)
> at org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(DelegatingStatement.java:114)
> at org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1204)
> at org.apache.openjpa.jdbc.schema.SchemaTool.createIndex(SchemaTool.java:1019)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:554)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:344)
> at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:321)
> at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:501)
> Per Informaix SQL syntax guide (Create Index section):
> You can not add a unique index to a column or column list that a primary -key constraint on it. The reason is that defining the column or column list as the primary key causes the database server to create a unique internal index on the column or column list. So you cannot create another unique index on this column or column list with CREATE INDEX statement.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (OPENJPA-605) Informix will throw an exception when
a unique index is explictily created on the primary key columns
Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-605?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Fay Wang updated OPENJPA-605:
-----------------------------
Attachment: openjpa.patch
The patch fixes the NPE introduced from the earlier one.
> Informix will throw an exception when a unique index is explictily created on the primary key columns
> -----------------------------------------------------------------------------------------------------
>
> Key: OPENJPA-605
> URL: https://issues.apache.org/jira/browse/OPENJPA-605
> Project: OpenJPA
> Issue Type: Bug
> Reporter: Fay Wang
> Attachments: openjpa.patch, openjpa.patch
>
>
> When an entity is defined as following (unique index annotation on the primary key field. In this situation):
> @Entity
> @Table(name="AddressBean")
> public class AddressBeanAno implements IAddressBean, Serializable {
> @EmbeddedId
> @Index(name="street_index",unique=true)
> @Column(length=30)
> private AddressPK street;
> Informix will issue an error:
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Index already exists on column. {stmnt 1440372186 CREATE UNIQUE INDEX street_index ON AddressBean (street)} [code=-350, state=S0011]
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:192)
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$3(LoggingConnectionDecorator.java:189)
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:762)
> at org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(DelegatingStatement.java:114)
> at org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1204)
> at org.apache.openjpa.jdbc.schema.SchemaTool.createIndex(SchemaTool.java:1019)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:554)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:344)
> at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:321)
> at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:501)
> Per Informaix SQL syntax guide (Create Index section):
> You can not add a unique index to a column or column list that a primary -key constraint on it. The reason is that defining the column or column list as the primary key causes the database server to create a unique internal index on the column or column list. So you cannot create another unique index on this column or column list with CREATE INDEX statement.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (OPENJPA-605) Informix will throw an exception when
a unique index is explictily created on the primary key columns
Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-605?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Fay Wang updated OPENJPA-605:
-----------------------------
Attachment: openjpa.patch
The attached patch fixes this problem.
> Informix will throw an exception when a unique index is explictily created on the primary key columns
> -----------------------------------------------------------------------------------------------------
>
> Key: OPENJPA-605
> URL: https://issues.apache.org/jira/browse/OPENJPA-605
> Project: OpenJPA
> Issue Type: Bug
> Reporter: Fay Wang
> Attachments: openjpa.patch
>
>
> When an entity is defined as following (unique index annotation on the primary key field. In this situation):
> @Entity
> @Table(name="AddressBean")
> public class AddressBeanAno implements IAddressBean, Serializable {
> @EmbeddedId
> @Index(name="street_index",unique=true)
> @Column(length=30)
> private AddressPK street;
> Informix will issue an error:
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Index already exists on column. {stmnt 1440372186 CREATE UNIQUE INDEX street_index ON AddressBean (street)} [code=-350, state=S0011]
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:192)
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$3(LoggingConnectionDecorator.java:189)
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:762)
> at org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(DelegatingStatement.java:114)
> at org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1204)
> at org.apache.openjpa.jdbc.schema.SchemaTool.createIndex(SchemaTool.java:1019)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:554)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:344)
> at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:321)
> at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:501)
> Per Informaix SQL syntax guide (Create Index section):
> You can not add a unique index to a column or column list that a primary -key constraint on it. The reason is that defining the column or column list as the primary key causes the database server to create a unique internal index on the column or column list. So you cannot create another unique index on this column or column list with CREATE INDEX statement.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (OPENJPA-605) Informix will throw an exception when
a unique index is explictily created on the primary key columns
Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-605?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Dick updated OPENJPA-605:
---------------------------------
Fix Version/s: 1.0.4
> Informix will throw an exception when a unique index is explictily created on the primary key columns
> -----------------------------------------------------------------------------------------------------
>
> Key: OPENJPA-605
> URL: https://issues.apache.org/jira/browse/OPENJPA-605
> Project: OpenJPA
> Issue Type: Bug
> Reporter: Fay Wang
> Assignee: Catalina Wei
> Fix For: 1.0.4, 1.2.0
>
> Attachments: openjpa.patch, openjpa.patch, openjpa.patch, openjpa.patch
>
>
> When an entity is defined as following (unique index annotation on the primary key field. In this situation):
> @Entity
> @Table(name="AddressBean")
> public class AddressBeanAno implements IAddressBean, Serializable {
> @EmbeddedId
> @Index(name="street_index",unique=true)
> @Column(length=30)
> private AddressPK street;
> Informix will issue an error:
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Index already exists on column. {stmnt 1440372186 CREATE UNIQUE INDEX street_index ON AddressBean (street)} [code=-350, state=S0011]
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:192)
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$3(LoggingConnectionDecorator.java:189)
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:762)
> at org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(DelegatingStatement.java:114)
> at org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1204)
> at org.apache.openjpa.jdbc.schema.SchemaTool.createIndex(SchemaTool.java:1019)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:554)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:344)
> at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:321)
> at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:501)
> Per Informaix SQL syntax guide (Create Index section):
> You can not add a unique index to a column or column list that a primary -key constraint on it. The reason is that defining the column or column list as the primary key causes the database server to create a unique internal index on the column or column list. So you cannot create another unique index on this column or column list with CREATE INDEX statement.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (OPENJPA-605) Informix will throw an exception when
a unique index is explictily created on the primary key columns
Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-605?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Fay Wang updated OPENJPA-605:
-----------------------------
Attachment: openjpa.patch
Sorry, I did not notice Albert's comments. This patch is based on his comments.
> Informix will throw an exception when a unique index is explictily created on the primary key columns
> -----------------------------------------------------------------------------------------------------
>
> Key: OPENJPA-605
> URL: https://issues.apache.org/jira/browse/OPENJPA-605
> Project: OpenJPA
> Issue Type: Bug
> Reporter: Fay Wang
> Attachments: openjpa.patch, openjpa.patch, openjpa.patch, openjpa.patch
>
>
> When an entity is defined as following (unique index annotation on the primary key field. In this situation):
> @Entity
> @Table(name="AddressBean")
> public class AddressBeanAno implements IAddressBean, Serializable {
> @EmbeddedId
> @Index(name="street_index",unique=true)
> @Column(length=30)
> private AddressPK street;
> Informix will issue an error:
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Index already exists on column. {stmnt 1440372186 CREATE UNIQUE INDEX street_index ON AddressBean (street)} [code=-350, state=S0011]
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:192)
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$3(LoggingConnectionDecorator.java:189)
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:762)
> at org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(DelegatingStatement.java:114)
> at org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1204)
> at org.apache.openjpa.jdbc.schema.SchemaTool.createIndex(SchemaTool.java:1019)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:554)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:344)
> at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:321)
> at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:501)
> Per Informaix SQL syntax guide (Create Index section):
> You can not add a unique index to a column or column list that a primary -key constraint on it. The reason is that defining the column or column list as the primary key causes the database server to create a unique internal index on the column or column list. So you cannot create another unique index on this column or column list with CREATE INDEX statement.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (OPENJPA-605) Informix will throw an exception
when a unique index is explictily created on the primary key columns
Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12598440#action_12598440 ]
Pinaki Poddar commented on OPENJPA-605:
---------------------------------------
Agree with Albert's suggestion.
An extra method may not be required though.
The method implementation in InformixDBDictionary could be:
public String[] getCreateIndexSQL(Index index) {
return (isIndexOnThe PrimaryKey(index)) ? new String[0] ? super.getCreateIndexSQL(index);
}
where isIndexOnThePrimaryKey(index) can encapsulate the logic presented in the patch.
> Informix will throw an exception when a unique index is explictily created on the primary key columns
> -----------------------------------------------------------------------------------------------------
>
> Key: OPENJPA-605
> URL: https://issues.apache.org/jira/browse/OPENJPA-605
> Project: OpenJPA
> Issue Type: Bug
> Reporter: Fay Wang
> Attachments: openjpa.patch, openjpa.patch
>
>
> When an entity is defined as following (unique index annotation on the primary key field. In this situation):
> @Entity
> @Table(name="AddressBean")
> public class AddressBeanAno implements IAddressBean, Serializable {
> @EmbeddedId
> @Index(name="street_index",unique=true)
> @Column(length=30)
> private AddressPK street;
> Informix will issue an error:
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Index already exists on column. {stmnt 1440372186 CREATE UNIQUE INDEX street_index ON AddressBean (street)} [code=-350, state=S0011]
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:192)
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$3(LoggingConnectionDecorator.java:189)
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:762)
> at org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(DelegatingStatement.java:114)
> at org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1204)
> at org.apache.openjpa.jdbc.schema.SchemaTool.createIndex(SchemaTool.java:1019)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:554)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:344)
> at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:321)
> at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:501)
> Per Informaix SQL syntax guide (Create Index section):
> You can not add a unique index to a column or column list that a primary -key constraint on it. The reason is that defining the column or column list as the primary key causes the database server to create a unique internal index on the column or column list. So you cannot create another unique index on this column or column list with CREATE INDEX statement.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (OPENJPA-605) Informix will throw an exception
when a unique index is explictily created on the primary key columns
Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-605?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Dick resolved OPENJPA-605.
----------------------------------
Resolution: Fixed
Fix Version/s: 1.2.0
> Informix will throw an exception when a unique index is explictily created on the primary key columns
> -----------------------------------------------------------------------------------------------------
>
> Key: OPENJPA-605
> URL: https://issues.apache.org/jira/browse/OPENJPA-605
> Project: OpenJPA
> Issue Type: Bug
> Reporter: Fay Wang
> Assignee: Michael Dick
> Fix For: 1.2.0
>
> Attachments: openjpa.patch, openjpa.patch, openjpa.patch, openjpa.patch
>
>
> When an entity is defined as following (unique index annotation on the primary key field. In this situation):
> @Entity
> @Table(name="AddressBean")
> public class AddressBeanAno implements IAddressBean, Serializable {
> @EmbeddedId
> @Index(name="street_index",unique=true)
> @Column(length=30)
> private AddressPK street;
> Informix will issue an error:
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Index already exists on column. {stmnt 1440372186 CREATE UNIQUE INDEX street_index ON AddressBean (street)} [code=-350, state=S0011]
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:192)
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$3(LoggingConnectionDecorator.java:189)
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:762)
> at org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(DelegatingStatement.java:114)
> at org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1204)
> at org.apache.openjpa.jdbc.schema.SchemaTool.createIndex(SchemaTool.java:1019)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:554)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:344)
> at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:321)
> at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:501)
> Per Informaix SQL syntax guide (Create Index section):
> You can not add a unique index to a column or column list that a primary -key constraint on it. The reason is that defining the column or column list as the primary key causes the database server to create a unique internal index on the column or column list. So you cannot create another unique index on this column or column list with CREATE INDEX statement.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (OPENJPA-605) Informix will throw an exception
when a unique index is explictily created on the primary key columns
Posted by "Albert Lee (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12598432#action_12598432 ]
Albert Lee commented on OPENJPA-605:
------------------------------------
Fay,
Can the proposed solution encapsulate in the dictionary? I.e.
public boolean createIndex(Index idx, Table table)
throws SQLException {
if ( !_dict.needsToCreateIndex(idx,table)) {
return true;
}
.......
public class InformixDictionary .... {
public boolean needsToCreateIndex(Index idx, Table table) {
Column[] cols = idx.getColumns();
Column[] pkCols = table.getPrimaryKey().getColumns();
if (cols.length == pkCols.length) {
String[] colNames = new String[cols.length];
String[] pkColNames = new String[cols.length];
for (int i = 0; i < cols.length; i++)
colNames[i] = cols[i].getName();
for (int i = 0; i < pkCols.length; i++)
pkColNames[i] = pkCols[i].getName();
if (java.util.Arrays.equals(colNames, pkColNames))
return false;
}
return true;
}
}
public class DBDictionary ....{
public boolean needsToCreateIndex(Index idx, Table table) {
return true;
}
}
Thanks,
Albert Lee.
> Informix will throw an exception when a unique index is explictily created on the primary key columns
> -----------------------------------------------------------------------------------------------------
>
> Key: OPENJPA-605
> URL: https://issues.apache.org/jira/browse/OPENJPA-605
> Project: OpenJPA
> Issue Type: Bug
> Reporter: Fay Wang
> Attachments: openjpa.patch, openjpa.patch
>
>
> When an entity is defined as following (unique index annotation on the primary key field. In this situation):
> @Entity
> @Table(name="AddressBean")
> public class AddressBeanAno implements IAddressBean, Serializable {
> @EmbeddedId
> @Index(name="street_index",unique=true)
> @Column(length=30)
> private AddressPK street;
> Informix will issue an error:
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Index already exists on column. {stmnt 1440372186 CREATE UNIQUE INDEX street_index ON AddressBean (street)} [code=-350, state=S0011]
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:192)
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$3(LoggingConnectionDecorator.java:189)
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:762)
> at org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(DelegatingStatement.java:114)
> at org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1204)
> at org.apache.openjpa.jdbc.schema.SchemaTool.createIndex(SchemaTool.java:1019)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:554)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:344)
> at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:321)
> at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:501)
> Per Informaix SQL syntax guide (Create Index section):
> You can not add a unique index to a column or column list that a primary -key constraint on it. The reason is that defining the column or column list as the primary key causes the database server to create a unique internal index on the column or column list. So you cannot create another unique index on this column or column list with CREATE INDEX statement.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (OPENJPA-605) Informix will throw an exception when
a unique index is explictily created on the primary key columns
Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-605?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Fay Wang updated OPENJPA-605:
-----------------------------
Attachment: openjpa.patch
This patch is per Pinaki's comments.
> Informix will throw an exception when a unique index is explictily created on the primary key columns
> -----------------------------------------------------------------------------------------------------
>
> Key: OPENJPA-605
> URL: https://issues.apache.org/jira/browse/OPENJPA-605
> Project: OpenJPA
> Issue Type: Bug
> Reporter: Fay Wang
> Attachments: openjpa.patch, openjpa.patch, openjpa.patch
>
>
> When an entity is defined as following (unique index annotation on the primary key field. In this situation):
> @Entity
> @Table(name="AddressBean")
> public class AddressBeanAno implements IAddressBean, Serializable {
> @EmbeddedId
> @Index(name="street_index",unique=true)
> @Column(length=30)
> private AddressPK street;
> Informix will issue an error:
> Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Index already exists on column. {stmnt 1440372186 CREATE UNIQUE INDEX street_index ON AddressBean (street)} [code=-350, state=S0011]
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:192)
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$3(LoggingConnectionDecorator.java:189)
> at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:762)
> at org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(DelegatingStatement.java:114)
> at org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1204)
> at org.apache.openjpa.jdbc.schema.SchemaTool.createIndex(SchemaTool.java:1019)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:554)
> at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:344)
> at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:321)
> at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:501)
> Per Informaix SQL syntax guide (Create Index section):
> You can not add a unique index to a column or column list that a primary -key constraint on it. The reason is that defining the column or column list as the primary key causes the database server to create a unique internal index on the column or column list. So you cannot create another unique index on this column or column list with CREATE INDEX statement.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.