Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-74608

DB error ORA-01408 (oracle) when CREATE INDEX on Primary Key



      Steps to Reproduce

      1. Update the basic-service/service.xml in liferay-blade-samples to include a finder on the primary key column.
        		<finder name="FooIds" return-type="Collection">
        			<finder-column name="fooId" arrayable-operator="OR" comparator="="/>
      2. Run blade gw buildService

      Expected result is that we do not add an index for fooId (it's the primary key, and so an index already exists for it) in src/main/resources/META-INF/sql/indexes.sql. Actual result is that we do add an index for fooId in src/main/resources/META-INF/sql/indexes.sql


      When I define a custom finder that includes the entity's only primary key, the Service Builder process creates the SQL CREATE INDEX statement for the primary key (in the indexes.sql file).

      When you deploy the bundle in an environment with the Oracle database, the deployment process fails because of this oracle error: ORA-01408: such column list already indexed

      Follow the finder's definition: 

      <finder name="HorseIds" return-type="Collection"><finder-column name="horseId" arrayable-operator="OR" comparator="="/></finder> 

      I know there is already a finder that might be fine, but I've presented the case of existing software that you do not want to refactoring.....it could also be a matter of "convenience." The finder custom returns a List<Horse> object, on the contrary, the fetchByPrimaryKeys method returns Map <Serializable, Horse>

      I found the solution to the error by using the db-index attribute on the finder, set with the false value.

      Before I opened this issue I wrote a post How to resolve the Oracle ORA-01408 error on Liferay on my blog where I explained in detail the error and the solution.

      Minhchau Dang thinks this behavior is to be considered a Liferay bug, for this reason I opened this issue.




            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created:
                Days since last comment:
                39 weeks, 1 day ago


                Version Package