I'm running Roo 1.0.2 via STS 2.3.1 and think ROO is really cool and helpful. But why does ROO seem to ignore the identity field I specify in my ROO entity script:
entity --class com.a2innovate.domain.A2IUser --abstract --inheritanceType SINGLE_TABLE --identifierField id
field number --class com.a2innovate.domain.A2IUser --fieldName id --type java.lang.Long --notNull
An excerpt from the generated class is:
@Entity
@RooJavaBean
@RooToString
@RooEntity(identifierField = "id")
public class A2IUser {
@NotNull
private Long id;
An excerpt from the corresponding Entity.aj is:
privileged aspect A2IUser_Roo_Entity {
@PersistenceContext
transient EntityManager A2IUser.entityManager;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "_id")
private Long A2IUser._id;
So I have several questions:
1. Note that the generated java class is not abstract. Why was the --abstract specification on the Roo entity definition ignored. (Note that I have tried that clinic.roo script and that seems to generate the class as "public abstract", which is what I would expect. That would seem to point to a problem with my roo entity specification, but I'm not seeing the problem.)
2. Why does roo generate a second identity field (_id), when I clearly designated the field "id" to be the entity identity field ( "--identifierField id").
And how should I remove the spurious field from the ...Roo_Entity.aj file? (My understanding is that we are not supposed to edit those files.) Both "id" and "-id" show as columns in the database table.
As a follow on, I have tried editing the java file to explicitly designate the "id" field as the identity field:
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
@NotNull
private Long id;
but after roo regenerates the corresponding Roo_Entity.aj file it still contains "_id" annotated with @Id.


Reply With Quote
