Entity Hierarchy
Shell
BaseProduct (abstract, @MappedSuperclass)├── SupplierProduct (@Entity, table: supplier_product)├── CompanyProduct (@Entity, table: company_product)└── BaseTextileProduct (abstract, @MappedSuperclass)├── YarnProduct (@Entity, table: yarn_product)├── FiberProduct (@Entity, table: fiber_product)└── FabricProduct (@Entity, table: fabric_product)
Note
Textile products extend BaseTextileProduct which adds supplierId, companyId, userId, and textileCategory. See Textile Products Module → for details.
BaseProduct Fields
| Field | Type | Description |
|---|---|---|
id | Long | Auto-generated PK |
name | String | Product name (required) |
code | String | Product code |
category | String | Product category |
subcategory | String | Product subcategory |
description | String | Optional description |
technicalSpecs | String | Technical specifications |
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) |
pricePerUnit | BigDecimal | Price per unit |
currency | String | ISO 4217 currency code |
minimumOrder | Double | Minimum order quantity |
productWeightKg | Double | Product weight in kg |
gotsCertified | Boolean | GOTS certification |
grsCertified | Boolean | GRS certification |
oekoTexCertified | Boolean | OEKO-TEX certification |
cradleToCradleCertified | Boolean | Cradle to Cradle certification |
betterCottonCertified | Boolean | Better Cotton certification |
otherCertifications | String | Other certification details |
recycledContentPercent | Double | Percentage of recycled content |
organicContentPercent | Double | Percentage of organic content |
sustainabilityNotes | String | Sustainability notes |
available | Boolean | Availability flag (default: true) |
metadata | Map<String, Object> | Arbitrary JSON key-value pairs |
createdAt | LocalDateTime | Auto-set on persist |
updatedAt | LocalDateTime | Auto-set on update |
UnitOfMeasure Enum
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) |
userId | Long | Creator user ID |
CompanyProduct Extra Fields
| Field | Type | Description |
|---|---|---|
companyId | Long | Company ID |
userId | Long | Creator user ID |
Entity Metadata
The metadata field allows attaching arbitrary JSON attributes to products without schema changes:
JSON
{"erp_sku": "ERP-FAB-001","season": "SS2026","moq_unit": "METERS"}