Announcement Announcement Module
No announcement yet.
Spring Roo DBRE and MS SQL Server 2008 with composite primary keys Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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?


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


      • #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


        • #5
 raised and completed.


          • #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 ....


            • #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


              • #8
                how do i raise an issue ?


                • #9
                  Go to


                  • #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 ?