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-6280: Migrate GlobalProperty from Hibernate Mapping XML to JPA annotations #4805

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

Conversation

ManojLL
Copy link
Contributor

@ManojLL ManojLL commented Oct 27, 2024

Description of what I changed

Issue I worked on

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

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

private String propertyValue = "";

@Transient
private transient Object typedValue;
Copy link
Member

Choose a reason for hiding this comment

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

Do we need transient 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.

@wikumChamith I updated the PR

private User changedBy;

@Column(name = "date_changed")
Copy link
Member

Choose a reason for hiding this comment

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

Don't we have a length for this column in XML mapping?

private String property = "";

@Column(name = "property_value", columnDefinition = "TEXT", length = 65535)
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to define a length with TEXT?

@wikumChamith
Copy link
Member

Have you checked whether the audit table is generated correctly? It should have the same DDL as before.

@wikumChamith
Copy link
Member

@ManojLL can you resolve the merge conflicts?

@ManojLL
Copy link
Contributor Author

ManojLL commented Oct 27, 2024

Have you checked whether the audit table is generated correctly? It should have the same DDL as before.

global_property_AUD table is generated

@ManojLL
Copy link
Contributor Author

ManojLL commented Oct 27, 2024

@ManojLL can you resolve the merge conflicts?

fixed the merge conflict

Copy link
Member

@wikumChamith wikumChamith left a comment

Choose a reason for hiding this comment

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

@dkayiwa can you take a look at this PR?

private boolean dirty = false;

@Column(name = "description", columnDefinition = "TEXT")
@Lob
Copy link
Member

Choose a reason for hiding this comment

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

Should this really be a LOB?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if we do not use lob , we are getting an error like : SchemaManagement Schema-validation: wrong column type encountered in column [description] in table [global_property]; found [clob (Types#CLOB)], but expecting [text (Types#VARCHAR)].

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dkayiwa @wikumChamith I change the description column to VARCHAR(1024) data type.

Copy link
Member

@wikumChamith wikumChamith left a comment

Choose a reason for hiding this comment

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

@dkayiwa is this ready to merge?

@dkayiwa
Copy link
Member

dkayiwa commented Nov 4, 2024

Why are we modifying the database alongside this?

@ManojLL
Copy link
Contributor Author

ManojLL commented Nov 4, 2024

Why are we modifying the database alongside this?

we don't store lengthy text for descriptions, that is why I change description column type from TEXT to VARCHAR.

@wikumChamith
Copy link
Member

Why are we modifying the database alongside this?

@dkayiwa I think we should make the description use varchar instead of text. Otherwise, we'll have to use @Lob with the JPA for description. We discussed about this in here: #4806

@dkayiwa
Copy link
Member

dkayiwa commented Nov 5, 2024

That is correct.

@wikumChamith wikumChamith requested a review from dkayiwa November 5, 2024 15:41
@@ -169,5 +169,13 @@
referencedTableName="obs"
referencedColumnNames="obs_id"/>
</changeSet>

<changeSet id="TRUNK-6280-2024-11-01" author="manojll">
<preConditions onFail="MARK_RAN">
Copy link
Member

@dkayiwa dkayiwa Nov 5, 2024

Choose a reason for hiding this comment

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

Let us try as much as we can to avoid mixing database changes with JPA annotations migration.

Copy link
Member

Choose a reason for hiding this comment

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

@ManojLL let's create a separate ticket and a PR for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dkayiwa @wikumChamith This is the PR for changing description type varchar : #4819

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