0

If I have a class entity having more than 1 PK, should I use identifier class or embeddable class (or is it the same)?

I am having problems dealing with the @RooJavaBean class with more than 1 @Id:

@RooJavaBean
// other Roo Entity Annotation
class EntityTable {

    @Id @Column(name="fk_entity_sub_one")
    private Integer fkPkOne;

    @Id @Column(name="fk_entity_sub_one")
    private Integer fkPkTwo;
}

Note: I used primitive data-type object instead of the entity object because I don't need to a return map. (Did I have the right idea to save memory upon entity loading?)

David B
  • 3,269
  • 12
  • 48
  • 80

1 Answers1

0

Try this commands:

   entity jpa --class ~.domain.EntityTable --identifierType ~.domain.EntityTablePk --entityName EntityTable --identifierField myPk --table TABLE
   field number --fieldName fkPkOne --type java.lang.Integer --column fk_entity_sub_one --class ~.domain.EntityTablePk
   field number --fieldName fkPkTwo --type java.lang.Integer --column fk_entity_sub_two --class ~.domain.EntityTablePk

And look at JPA Documentation

jmvivo
  • 2,653
  • 1
  • 16
  • 20
  • Thanks. I have the same output when I try to do `database reverse engineer`. Yet I am having a problem on accessing the identifier class. I know it's out of the concept of this thread yet I have already created one for it [here](http://stackoverflow.com/questions/22754924/accessing-roo-identifier) – David B Mar 31 '14 at 07:16