-
Feb 28th, 2011, 06:59 AM
#1
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
-
Feb 28th, 2011, 03:01 PM
#2
Was a composite key class, eg FooPK, generated?
-
Feb 28th, 2011, 03:13 PM
#3
yes ... and all the fields in this class were not generated correctly ...
-
Feb 28th, 2011, 03:14 PM
#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
-
Feb 28th, 2011, 06:27 PM
#5
-
Mar 1st, 2011, 02:12 AM
#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 ....
-
Mar 1st, 2011, 02:35 AM
#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
-
Mar 2nd, 2011, 03:42 AM
#8
how do i raise an issue ?
-
Mar 2nd, 2011, 04:30 AM
#9
-
Mar 2nd, 2011, 05:50 AM
#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 ?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules