Maybe 'id' and 'description' are reserved words?
Maybe 'id' and 'description' are reserved words?
Yes you are on the right track. Your UserRole type uses a field named 'id' as part of the type definition. This field name is also the field name Roo chooses by default as a JPA @Id. Therefore, you see that the updates to UserRole are handled different to what you would normally expect. You have two choices to address this issue:
1. Rename your id field to something other than id (ie roleId). This way Roo will still choose id as the identifier for persistence purposes and roleId becomes independent of that.
2. Change the default name of the identifier in your UserRole type:
This way you can retain your 'id' field name and instruct Roo to use the 'persistenceId' (or any other name) field for its internal JPA purposes.Code:@RooEntity(identifierField="persistenceId") public class UserRole{...}
If you use any of these options your application should work fine.
HTH
Stefan Schmidt
Software Engineer, Spring Roo
SpringSource - a division of VMware
twitter @schmidtstefan
Hi Stefen,
I have been trying previous code and it was not working for me. Did some changes and now I can see both side of the many-to-many updated
Missing part being --mappedBy communitiesCode:project --topLevelPackage com.foo.opensource persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY entity --class ~.domain.Community --testAutomatically field string name entity --class ~.domain.Person --testAutomatically field string name field set --fieldName communities --element ~.domain.Community --cardinality MANY_TO_MANY field set --fieldName members --element ~.domain.Person --class ~.domain.Community --cardinality MANY_TO_MANY --mappedBy communities controller all --package ~.web
Unfortunately, I can only add communities to poeple and not the opposite from the UI. Still something missing
--Marc
After looking at hibernate doc here: http://docs.jboss.org/hibernate/core...-bidirectional
found that "Changes made only to the inverse end of the association are not persisted."
so that explains why I can't add items from both sides of the association.