Skip to content

Conversation

@vietnguyen
Copy link
Contributor

@vietnguyen vietnguyen commented Apr 29, 2025

Summary

  • This PR attempt to migrate Object Model mapping from xml to annotation for a few classes. The entities updated are: CategoryCombo, DataSetElement, OptionSet.
  • The annotations used are from jakarta.persistence package together a few specific from org.hibernate.annotations.
  • Removed the extend of BaseIdentifiableObject for affected classes. We will need to create another Base Class which comply with annotation mapping rules.

Test

  • Manually test the basic functions such as: crud operations, translations, attributes, sharing.

*/
@Entity
@Table(name = "categorycombo")
@Setter

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
IdentifiableObject.setSharing
; it is advisable to add an Override annotation.
This method overrides
IdentifiableObject.setName
; it is advisable to add an Override annotation.
This method overrides
IdentifiableObject.setCode
; it is advisable to add an Override annotation.
This method overrides
IdentifiableObject.setId
; it is advisable to add an Override annotation.
@JacksonXmlRootElement(localName = "optionSet", namespace = DxfNamespaces.DXF_2_0)
public class OptionSet extends BaseIdentifiableObject implements VersionedObject, MetadataObject {
private List<Option> options = new ArrayList<>();
@Setter

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
IdentifiableObject.setAccess
; it is advisable to add an Override annotation.
This method overrides
IdentifiableObject.setSharing
; it is advisable to add an Override annotation.
This method overrides
IdentifiableObject.setCreatedBy
; it is advisable to add an Override annotation.
This method overrides
IdentifiableObject.setName
; it is advisable to add an Override annotation.
This method overrides
IdentifiableObject.setLastUpdatedBy
; it is advisable to add an Override annotation.
This method overrides
IdentifiableObject.setLastUpdated
; it is advisable to add an Override annotation.
This method overrides
IdentifiableObject.setCreated
; it is advisable to add an Override annotation.
This method overrides
IdentifiableObject.setCode
; it is advisable to add an Override annotation.
This method overrides
IdentifiableObject.setUid
; it is advisable to add an Override annotation.
This method overrides
IdentifiableObject.setId
; it is advisable to add an Override annotation.
@vietnguyen vietnguyen marked this pull request as ready for review May 12, 2025 18:06
@vietnguyen vietnguyen changed the title feat: annotation mapping for CategoryCombo feat: annotation mapping May 13, 2025
@vietnguyen vietnguyen changed the title feat: annotation mapping ref: annotation mapping May 13, 2025
@vietnguyen vietnguyen changed the title ref: annotation mapping refactor: annotation mapping May 13, 2025
@david-mackessy
Copy link
Contributor

The option set hbm file is being removed, is there a reason why the other 2 hbm files are not?
Can you mention what kind of testing was done in the description to help reviewers understand how this change has been tested?

Copy link
Contributor

@jbee jbee left a comment

Choose a reason for hiding this comment

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

🎉 Great work!

@jbee
Copy link
Contributor

jbee commented May 13, 2025

The option set hbm file is being removed, is there a reason why the other 2 hbm files are not?

I was confused by the same thing first, I checked at least for the CategoryOptionCombo. That got updated because the CategoryCombo was converted (not the CategoryOptionCombo)

@sonarqubecloud
Copy link

@vietnguyen
Copy link
Contributor Author

vietnguyen commented May 13, 2025

The option set hbm file is being removed, is there a reason why the other 2 hbm files are not? Can you mention what kind of testing was done in the description to help reviewers understand how this change has been tested?

@david-mackessy Nice catch, remove those hbm files now. I was using the hibernate config to make use of the annotation mapping.

@vietnguyen vietnguyen merged commit fa6a855 into master May 13, 2025
16 checks passed
@vietnguyen vietnguyen deleted the hibernate-annotation branch May 13, 2025 14:42
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.

4 participants