Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: ROO + composite primary keys in data on demand

  1. #1

    Smile ROO + composite primary keys in data on demand

    Hi,

    with roo, i generated mvc application from database schema. when i try to click on "List all Adf Controllers" in the UI screen. it is displying error message "ERROR org.hibernate.util.JDBCExceptionReporter - ORA-00907: missing right parenthesis".
    I think the issue is with composite primary keys.

    Is roo still nor supporting composite primary keys(https://jira.springsource.org/browse/ROO-2214) ?

    Anyone pls help me in this??

    Thanks,
    Pavan

  2. #2

    Default

    Hi

    Currently I am working with Spring Roo + composite PKs and I realised there are lots of bugs and problems you have to solve.

    Even if generation finishes successfull you won't be able to show/edit etc Objects with composite PKs because the Composite PKs won't be saved on the Edit/Show Pages correctly. The toString() Method of the Composite PK gets called to fill up the hidden id field during Update etc so you have to implement a toString method that generates a primary Key for the ID Field and for the way back (id field => Primary Key) ...

    I solved it the following way : I pushed in the classes working with combined primary keys and gave all the PK's a toString() Method and the Controllers a StringToPK(String) method. I don't think thats the best way to achive it but it worked and the rest of the application is still manged by Roo ...

  3. #3
    Join Date
    Dec 2005
    Posts
    929

    Default

    I am looking at ROO-2070 at the moment.
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  4. #4

    Default

    Hi cblicious ,

    I confused what u explained above......can you pls explain once again.....

    pls its urgent........

    Thanks,
    Pavan

  5. #5

    Default

    What confuses you ? Please explain !

  6. #6

    Default

    Hi,

    I'm using roo1.1.2. My roo application successfully running. But when i click on list link on some table in UI, Missing paranthesis exception is coming.

    I found for some of the "_Roo_Entity.aj" files has primarykey class. see below

    @EmbeddedId
    private EmfPageCriteriaFilterPK EmfPageCriteriaFilter.id;

    I think the issue with the PK class. Is there anyway to avoid creating PK classes.

    How to resolve this issue????????

    Thanks,
    Pavan

  7. #7

    Default

    I think you can't avoid PK Classes as long as your Databasedesign uses composite primary keys ...

    But the solution is quite simple ... If you add a toString() Method in the primary key (first Refactor -> push in so that the aspect's are gone) and in the next step you have to modify the show ... etc methods in the controllers.

    The toString method could generate someting like this :
    <keyvalue1>,<keyvalue2>,<keyvalue3> ...

    Following the sample of the "show" method
    Now the id in the URL contains your primary key. Now in order to use the default finder you will need a method which converts your ID String back to a primary key object. A normal Strinng.split() will do the the trick

  8. #8

    Default

    Hi,

    In My schema no table has composite primary key. even though it is creating PK classes for the tables.

    It is generating PK classes for those tables doesn't have primark key.

    Any Idea how to resolve thi issue???

    Thanks,
    Pavan

  9. #9
    Join Date
    Dec 2005
    Posts
    929

    Default

    If your table does not have a primary key defined, then DBRE, by design, will create a composite key consisting of all the columns in the table, as JPA requires a key. Create a primary key from one field and DBRE will remove the composite key on next introspection.

    Alan
    Alan Stewart
    Spring Roo Committer
    twitter @alankstewart

  10. #10

    Default

    Hi,

    Thanks for ur reply.....

    For some of the tables, when i click on list in roo UI, its throwing "ORA-01747: invalid user.table.column, table.column, or column specification" exception.

    Is this exception also because of composite primary key or something else??

    Thanks,
    Pavan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •