Skip to content

TRUNK-6522: Switch Obs domain to annotations#5719

Draft
kmvipin wants to merge 4 commits intoopenmrs:masterfrom
kmvipin:TRUNK-6522
Draft

TRUNK-6522: Switch Obs domain to annotations#5719
kmvipin wants to merge 4 commits intoopenmrs:masterfrom
kmvipin:TRUNK-6522

Conversation

@kmvipin
Copy link
Contributor

@kmvipin kmvipin commented Jan 29, 2026

Description of what I changed

TRUNK-6522: Switch Obs domain to annotations

Converted Obs.java from XML-based Hibernate mapping to JPA/Hibernate annotations. This change eliminates the need for Obs.hbm.xml mapping file by adding appropriate annotations directly to the domain class:

  • Added @entity and @table annotations for entity mapping
  • Added @id and @GeneratedValue for primary key configuration
  • Added @column annotations with proper constraints (nullable, length) for field mappings
  • Converted all many-to-one relationships to @manytoone and @joincolumn annotations
  • Added @TeMPOraL annotations for Date fields

The Obs.hbm.xml file can now be removed as all mapping configuration is handled through annotations.

Issue I worked on

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

Checklist: I completed these to help reviewers :)

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

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

Note : this PR currently in development



@Column(name = "status", length = 16, nullable = false)
@Enumerated(EnumType.STRING)
Copy link
Member

Choose a reason for hiding this comment

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

For the error that you are getting, try adding this on this field: @JdbcTypeCode(SqlTypes.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.

Sure, I will implement this!

@sonarqubecloud
Copy link

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.

2 participants

Comments