Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRUNK-5830: Migrate FieldType from Hibernate Mapping XML to JPA annotations #4804

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

ManojLL
Copy link
Contributor

@ManojLL ManojLL commented Oct 26, 2024

Description of what I changed

Issue I worked on

see https://issues.openmrs.org/browse/TRUNK-5830

Checklist: I completed these to help reviewers :)

  • My IDE is configured to follow the code style of this project.

    No? Unsure? -> configure your IDE, format the code and add the changes with git add . && git commit --amend

  • I have added tests to cover my changes. (If you refactored
    existing code that was well tested you do not have to add tests)

    No? -> write tests and add them to this commit git add . && git commit --amend

  • I ran mvn clean package right before creating this pull request and
    added all formatting changes to my commit.

    No? -> execute above command

  • All new and existing tests passed.

    No? -> figure out why and add the fix to your commit. It is your responsibility to make sure your code works.

  • My pull request is based on the latest changes of the master branch.

    No? Unsure? -> execute command git pull --rebase upstream master

@wikumChamith
Copy link
Member

wikumChamith commented Oct 27, 2024

@ManojLL I think to solve the build error you might need to add "date_changed" to the Liqibase schema. I don't think there is a viable way to make an inherited field transient. @dkayiwa, @ibacher what would be the best solution here?

@dkayiwa
Copy link
Member

dkayiwa commented Oct 27, 2024

Can you start by fixing the merge conflicts?

@ManojLL
Copy link
Contributor Author

ManojLL commented Oct 27, 2024

Can you start by fixing the merge conflicts?

fixed the merge conflict

@ManojLL
Copy link
Contributor Author

ManojLL commented Oct 28, 2024

@dkayiwa @wikumChamith I added the missing columns to Field type table

@Audited
@AttributeOverrides(value = {
@AttributeOverride(name = "name", column = @Column(name = "name", length = 50, nullable = false)),
@AttributeOverride(name = "retired", column = @Column(name = "retired", columnDefinition = "boolean default false"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use "boolean default false" here?'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should set the retired column default value as false ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In BaseOpenmrsMetadata default value for retired is set to false.

@Column(name = "retired", nullable = false)
@Field
private Boolean retired = Boolean.FALSE;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without including columnDefinition = "boolean default false", HL7Service, OrderEntryIntergationTest, and MedicationDispenseServiceTest tests are getting failed.

Caused by: org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: NULL not allowed for column "RETIRED"; SQL statement: insert into FIELD_TYPE (FIELD_TYPE_ID, NAME, IS_SET, CREATOR, DATE_CREATED, UUID) values (?, ?, ?, ?, ?, ?) [23502-200] at org.h2.message.DbException.getJdbcSQLException(DbException.java:459)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dkayiwa, @ibacher what are your thoughts on this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not like the column definition value of boolean default false
Can we think of an alternative?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants