Caused by: org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: NULL not allowed for column "DATE_CREATED"; SQL statement:
insert into ROLE (ROLE, DESCRIPTION, UUID) values (?, ?, ?) [23502-200]
So what i had initially done in the pull request above is to manually change the datasets initialInMemoryTestDataset.xml and standardTestDataset.xml and added those columns in the role table hence having the OrderServiceTest tests passing. However, i realised i would have to change all the testdatasets depended on by most ServiceTests classes ie AdministrativeServiceTest, UserServiceTest, etc… Is this the way to go? (my guts tell me no).
The other option that i tested out and it seemed to work for the role entity was going to the BaseOpenmrsMetadata class and removing nullable=false from name, date_created, creator, retired, retire_reason. Is this viable?
Overriding the attributes that are not needed by adding this line @AttributeOverride(name = "dateCreated", column = @Column(name = "date_created")) and three others to cater for retire. retire_reason and name seems to work. However, the same doesn’t work for creator and i believe its because the creator field/column has been annotated with @ManyToOne(optional=false). The only work-around i have come across is to remove the optional=false and instead add nullable=false to the @JoinColumn.
I don’t see why we wouldn’t just add a creator, date_created, retired, retired_reason columns for the role table. name is trickier given that role is basically the same property…
The other option is to remove the Role class from the OpenmrsMetadata hierarchy altogether… I don’t know if we’re relying on it extending OpenmrsMetadata anywhere, but the way it’s currently mapped is a mess (i.e., it has a ton of instance-level properties that aren’t actually persisted anywhere).
Note: i built this distro using the changes on the two pull requests above
“message”: “[converting class org.openmrs.Role to org.openmrs.module.webservices.rest.web.representation.FullRepresentation@146cff29 => retired on class org.openmrs.Role => Unknown property ‘retired’ on class ‘class org.openmrs.Role’]”,