Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-3251

Composite key with Oracle - Gives error on rendering after creation, and on listing

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more



    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.2.2.RELEASE
    • None
    • Oracle, Windows 7, SpringSource STS


      I'm new to spring/spring roo and hibernate. I'm trying it out with my existing oracle database schema. This issue may be more related to JPA or hibernate, so please let me know if i'm reporting to wrong place, or doing something wrong, etc. I've seen the following issues regarding an entity mapped to a table with a composite key:

      1) when doing a listing... It appears to try to do a count() SQL with all three fields of key as arguments to the count()... Oracle doesn't allow this, and thus it throws an error.

      2) After saving a record... the record will be saved correctly, but an error is thrown... I believe regarding the rendering of the record.

      The issues occur only when the table has a composite key - on a legacy table with a single-field PK, it doesn't have this problem.

      I attached an example project with schema-creation script. It includes an example of the entity with the composite key and an entity with a single-field legacy key.

      Notes about the included example:
      1) run the "01" script as system or sys user, to create the sample user "roo" with password "roo".
      2) run the "02" sql script to create the two tables with primary keys.
      3) I altered the pom file... how it does the ojdbc jar, by doing this... Notice where I placed the ojdbc6.jar file:
      4) I also copied the ojdbc6.jar into this folder, so it's available once the app is deployed and running:
      5) I added this to each of the entities @RooJpaActiveRecord annotation, because my tables don't have a version field: versionField = ""
      6) The table that works okay (single field key) is: ac_master
      7) the table that doesn't work okay (composite key) is: defect_report




            Unassigned Unassigned
            darthluch LB
            tmarshall Trevor Marshall