Skip to content

NM-26: Port CatalogBrand and CatalogType entities to JPA#10

Open
devin-ai-integration[bot] wants to merge 1 commit into
devin/1779337581-nm22-spring-boot-initfrom
devin/1779383558-nm26-catalog-brand-type-entities
Open

NM-26: Port CatalogBrand and CatalogType entities to JPA#10
devin-ai-integration[bot] wants to merge 1 commit into
devin/1779337581-nm22-spring-boot-initfrom
devin/1779383558-nm26-catalog-brand-type-entities

Conversation

@devin-ai-integration
Copy link
Copy Markdown

Summary

Ports the CatalogBrand and CatalogType entities from .NET EF6 fluent configuration (CatalogDBContext.cs lines 29–55) to Java 21 JPA entity classes under com.eshop.modernized.model.

Mapping from EF6 → JPA:

EF6 Fluent Config JPA Annotation
.ToTable("CatalogBrand") / .ToTable("CatalogType") @Table(name = "CatalogBrand") / @Table(name = "CatalogType")
.HasKey(ci => ci.Id) + .IsRequired() @Id + @GeneratedValue(strategy = GenerationType.IDENTITY)
.IsRequired() @NotNull + @Column(nullable = false)
.HasMaxLength(100) @Size(max = 100) + @Column(length = 100)

Both entities include:

  • JPA-required no-arg constructor (protected)
  • Convenience constructor accepting the business field
  • Getters/setters
  • equals()/hashCode() on business key (brand/type), not generated ID
  • toString() returning the business field

Review & Testing Checklist for Human

  • Verify JPA annotations correctly mirror the EF6 fluent config constraints (Required@NotNull, MaxLength(100)@Size(max=100))
  • Confirm @Table(name=...) values match the original .NET table names exactly (CatalogBrand, CatalogType)
  • Check that @GeneratedValue(strategy = GenerationType.IDENTITY) is the correct ID strategy for your target database (the original EF6 config did not specify DatabaseGeneratedOption.None for these entities, so auto-increment is appropriate)

Notes

  • Based on the NM-22 Spring Boot project scaffold
  • Uses Integer wrapper type for @Id fields so Spring Data JPA isNew() detection works correctly (null = new entity)
  • Jakarta Validation annotations (jakarta.validation.constraints.*) used per Spring Boot 3.x / Jakarta EE

Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/50274beec75e4586b5a8f4cd4a652a97

Create model/CatalogBrand.java and model/CatalogType.java with:
- @entity and @table annotations matching EF6 table names
- @id with GenerationType.IDENTITY
- @NotNull and @SiZe(max=100) matching EF6 Required + MaxLength(100)
- @column constraints mirroring the fluent config in CatalogDBContext.cs
- Business-key equals/hashCode per Java best practices
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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.

0 participants