Announcement Announcement Module
Collapse
No announcement yet.
Spring Roo DBRE and MS SQL Server 2008 with composite primary keys Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Roo DBRE and MS SQL Server 2008 with composite primary keys

    If I am trying to generate a object with a composite key where different fields of the key are from the Type "char(2)"

    Spring Roo doesn't generate the " ,columnDefinition = "char", length = 2 " annotation, but only for the Fields which are in the primary composite key. Then this leads to an error during application startup, saying "Expected varchar(255) , but char(2) found"

    All other normal fields get annotated correctly ... what could that be ?

    Best regards

  • #2
    Was a composite key class, eg FooPK, generated?

    Comment


    • #3
      yes ... and all the fields in this class were not generated correctly ...

      Comment


      • #4
        I am not currently adding columnDefinition to fields in the PK class. Please raise a Jira request for this. It won't take long to do

        Comment


        • #5
          https://jira.springsource.org/browse/ROO-2186 raised and completed.
          Regards
          Alan

          Comment


          • #6
            coool thanks !

            I have found another issue !

            The HQL in the "public static long count<<Objectname>>() {..." Method doesn't seem to fit ....

            If you have a composite Primary Key it says ... "select count(o) from IscsProduct o" which gets transformed into something like "select count((pkrow1,pkrow2,pkrow3,pkrow4)) from table" and there I get the SQL error "count takes just one parameter" So I replaced it with count(*) and it works ....

            Comment


            • #7
              Roo's support for composite primary keys is minimal at the moment. Can you try different ORMs, like OpenJPA or EclipseLink (if not already)?

              Raise an issue - I should be able to fix this quickly

              Comment


              • #8
                how do i raise an issue ?

                Comment


                • #9
                  Go to https://jira.springsource.org/browse/ROO

                  Comment


                  • #10
                    I am developing a method to that Spring Roo (or at last, what it has generated) can work nicely with composite PKs

                    Currenlty I am using a toString mehtod for the PK and a decoder (eg. spilt) so that working with PKs trough the {id} Field works ...

                    maybe interested in integrating this approach when it works ?

                    Comment

                    Working...
                    X