Question

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?)

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top