java - Spring Roo @Id field not populated in DataOnDemand test -


i working web application built on spring roo 1.0.2. have defined entity has primary key personid column several other fields.

@id @column(name = "personid", precision = 10, scale = 0)     private long personid;  @size(max = 50) @column(name = "name") @notnull private string name;  ... 

the roo-managed integration tests contain function instantiates mock object , populates each of non-id fields.

public person persondataondemand.getnewtransientperson(int index) {     person obj = new person();         obj.setname("name_" + index);      //set other non-id fields      return obj; } 

this function called integration tests , subsequently fails database table has not null constraint on personid column. have tried explicitly setting @notnull annotation on personid column, has no effect. suspect has fact personid non-autogenerated primary key.

i know can address overriding integration tests , populating id myself, avoid if possible. know way can field automatically populated in managed dataondemand objects?

spring roo gerates own id field, in _entity.aj aspect. no field marked @id needed in "base"-class. roo managed id field should populated roo's dataondemand.

the data base column roo managed id "id" default. if need other colum name (for example match database schema) column specified @rooentity.identifiercolumn.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -