openmrs-core icon indicating copy to clipboard operation
openmrs-core copied to clipboard

TRUNK-6231: Migrate from Hibernate Mapping XML to JPA annotations.

Open wikumChamith opened this issue 9 months ago • 9 comments

Description of what I changed

Migrated the following entities from Hibernate mapping XML to JPA annotations:

  • DrugIngredient
  • FieldAnswer
  • AlertRecipient

Issue I worked on

see https://openmrs.atlassian.net/browse/TRUNK-6231

Checklist: I completed these to help reviewers :)

  • [x] 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

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

    No? -> execute above command

  • [x] 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.

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

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

wikumChamith avatar May 08 '24 15:05 wikumChamith

@wikumChamith you have not yet responded to my comment.

dkayiwa avatar May 19 '24 13:05 dkayiwa

@wikumChamith you have not yet responded to my comment.

Screenshot from 2024-05-19 19-06-14

Am I missing something :sweat_smile:

wikumChamith avatar May 19 '24 13:05 wikumChamith

Your screenshot has pending

dkayiwa avatar May 19 '24 14:05 dkayiwa

I replied to your question before. In case you are not seeing it, I have my answer here.

To replace this composite key.

<composite-id>
			<key-many-to-one name="alert" column="alert_id"	class="org.openmrs.notification.Alert" />
			<key-many-to-one name="recipient" class="org.openmrs.User" column="user_id" />
</composite-id>

wikumChamith avatar May 19 '24 14:05 wikumChamith

Can't we pull this off without creating the new class?

dkayiwa avatar May 19 '24 14:05 dkayiwa

I initially followed the recommended approach by creating a separate class. However, we can achieve this without creating an additional class. I have updated the PR accordingly.

wikumChamith avatar May 19 '24 14:05 wikumChamith

I initially followed the recommended approach by creating a separate class. However, we can achieve this without creating an additional class. I have updated the PR accordingly.

Did you test these changes by running the webapp and confirm that all is well?

dkayiwa avatar May 19 '24 19:05 dkayiwa

@wikumChamith i also find the title not clear enough. What are you migrating? Is it all the classes that are currently mapped to hibernate mapping xml files? In the past, we have done this as one entity at a time. That is, each with its own ticket and pull request.

dkayiwa avatar May 19 '24 22:05 dkayiwa

I agree. I'll try to create sperate tickets and pull requests for each entity.

wikumChamith avatar May 20 '24 05:05 wikumChamith

I am closing this PR to create separate pull requests for each entity.

wikumChamith avatar May 22 '24 08:05 wikumChamith