Caused by: org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: NULL not allowed for column "DATE_CREATED"; SQL statement:
insert into ROLE (ROLE, DESCRIPTION, UUID) values (?, ?, ?) [23502-200]
Options
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ā]ā,
This is exactly why i wanted you to run your changes to check if all is well. As for properties, use only those which the role object has after your changes in openmrs core.
Do not introduce any new functionality in regards to Roles. If roles have not been voidable or retirable, do not try to implement that now. It would be out of scope for the current work.