Entity Hierarchy
Shell
BaseProduct (abstract, @MappedSuperclass)├── SupplierProduct (@Entity, table: supplier_product)└── CompanyProduct (@Entity, table: company_product)
BaseProduct Fields
| Field | Type | Description |
|---|---|---|
id | Long | Auto-generated PK |
name | String | Product name (required) |
sku | String | Stock-keeping unit |
description | String | Optional description |
composition | String | Material composition |
productOriginCountry | String | ISO alpha-2 where product is manufactured ** |
rawMaterialOriginCountry | String | ISO alpha-2 where raw material originates ** |
unitOfMeasure | UnitOfMeasure | METERS, KG, PIECES, ROLLS. Default: KG ** |
quantityAvailable | Double | Current stock (≥ 0) ** |
leadTimeDays | Integer | Procurement lead time in days (≥ 0) ** |
productWeightKg | Double | Product weight in kg |
gotsCertified | Boolean | GOTS certification |
available | Boolean | Availability flag (default: true) |
createdAt | LocalDateTime | Auto-set on persist |
UnitOfMeasure Enum
New in v1.1.0
Java
@Schema(enumeration = {"METERS", "KG", "PIECES", "ROLLS"})public enum UnitOfMeasure {METERS, KG, PIECES, ROLLS}
Default value: KG (set in @PrePersist).
Country Code Validation
productOriginCountry and rawMaterialOriginCountry are annotated with @ISO3166CountryCode, a custom Jakarta Validation constraint that checks the value against the full ISO 3166-1 alpha-2 list. Invalid codes return 400 Bad Request.
Java
@ISO3166CountryCode@Column(name = "product_origin_country", length = 2)public String productOriginCountry;
SupplierProduct Extra Fields
| Field | Type | Description |
|---|---|---|
supplierId | Long | FK to Supplier.id (required) |
unitCost | BigDecimal | Purchase price per unit |
currency | String | ISO 4217 |
reachCompliant | boolean | REACH compliance |
certifications | List<String> | Product-level certifications |
CompanyProduct Extra Fields
| Field | Type | Description |
|---|---|---|
barcode | String | EAN/GTIN barcode |
unitSalePrice | BigDecimal | Selling price per unit |
sustainabilityScore | Integer | ESG score 0–100 |
recycledContentPercent | Double | % recycled content |