Announcement Announcement Module
No announcement yet.
Roo generating extraneous entity id Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Roo generating extraneous entity id

    I've got a set of entity objects (not created by Roo) that I want to expose using Roo web/mvc. These entities contain an id field and appropriate accessors and annotations. When I add the @RooEntity annotation to bring them in to the Roo workspace, Roo adds another 'id' field to the aspect file but calls it '_id', with get_id() and set_id() also created. The result being that the resultant class will have 2 id fields and the generated controller fails when attempting to save the entity as this new _id field doesn't exist in the db.

  • #2
    Did you add the @Id annotation to your actual id member?


    • #3
      Extraneous Ids

      Yeah, the entities we have all include @Id annotations. They were originally generated by Hibernate reverse engineering tools.


      • #4
        If you add a field annotated with @Id (or @EmbeddedId) in the .java file (along with the required getter/setter), it will be removed from the Roo-Entity.aj ITD. However, if you add a field (no annotation) with the same name as the @Id field, the @Id field in the ITD will have its name changed with a prefixed underscore. If you are seeing 2 @Id fields, please log a Jira request and attach a backup zip file of your project (use the Roo backup command).