Skip to content

Issue #7 - Create Flag Entity#18

Open
krakacudo wants to merge 6 commits into
vidya381:mainfrom
krakacudo:feature/issue-7-flag-entity
Open

Issue #7 - Create Flag Entity#18
krakacudo wants to merge 6 commits into
vidya381:mainfrom
krakacudo:feature/issue-7-flag-entity

Conversation

@krakacudo
Copy link
Copy Markdown

No description provided.

@vidya381
Copy link
Copy Markdown
Owner

vidya381 commented Apr 6, 2026

Thanks for the contribution! A few things to fix before we can merge.

  1. Missing key field : this is the most important one, it's how clients identify and evaluate flags. Add public String key; with @Column(unique = true, nullable = false).

  2. Wrong base class : PanacheEntity gives a Long id, this project uses UUID. Extend PanacheEntityBase instead and define the id field manually with @GeneratedValue(strategy = GenerationType.UUID).

  3. Fields should be public : Panache works with public fields, private fields won't behave as expected here.

  4. Add @Table(name = "flags") on the class and @Column(nullable = false) on required fields.

  5. Commit message : please follow conventional commits like feat: create Flag JPA entity

The @PrePersist and @PreUpdate logic is correct, nice work on that!

@krakacudo
Copy link
Copy Markdown
Author

Thanks for the contribution! A few things to fix before we can merge.

  1. Missing key field : this is the most important one, it's how clients identify and evaluate flags. Add public String key; with @Column(unique = true, nullable = false).
  2. Wrong base class : PanacheEntity gives a Long id, this project uses UUID. Extend PanacheEntityBase instead and define the id field manually with @GeneratedValue(strategy = GenerationType.UUID).
  3. Fields should be public : Panache works with public fields, private fields won't behave as expected here.
  4. Add @Table(name = "flags") on the class and @Column(nullable = false) on required fields.
  5. Commit message : please follow conventional commits like feat: create Flag JPA entity

The @PrePersist and @PreUpdate logic is correct, nice work on that!

All of these were added, as well as the separation between the id and uuid attributes in order to have more performant indexing at the database level while maintaining security.

Cheers!

@vidya381
Copy link
Copy Markdown
Owner

Getting closer! Still a few things to address:

  1. 'key' field is still missing, this was flagged in the first review too. Please add public String key; with @Column(name = "key", nullable = false, unique = true).

  2. On the id approach, the dual Long id + UUID uuid pattern makes sense for indexing but it's not the convention this project follows. Let's stick with a single UUID primary key to keep things consistent:

@Id
@GeneratedValue(strategy = GenerationType.UUID)
@Column(updatable = false, nullable = false)
public UUID id;
  1. Fields still need to be public. Panache won't work correctly with private fields. This one's been mentioned before so want to make sure it's not missed again.

The PanacheEntityBase, @Table, and column constraints are all good now though, nice work on those!

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