Overview
The textile module provides three specialized product types for the textile industry: Yarn, Fiber, and Fabric. Each extends the shared BaseProduct model (via BaseTextileProduct) with domain-specific attributes while inheriting all common product fields like composition, certifications, origin countries, and logistics.
Entity Hierarchy
BaseProduct (abstract, @MappedSuperclass)└── BaseTextileProduct (abstract, @MappedSuperclass)├── YarnProduct (@Entity, table: yarn_product)├── FiberProduct (@Entity, table: fiber_product)└── FabricProduct (@Entity, table: fabric_product)
BaseTextileProduct Fields
All textile products share these fields in addition to BaseProduct:
| Field | Type | Description |
|---|---|---|
supplierId | Long | FK to Supplier.id |
companyId | Long | FK to company |
userId | Long | Creator user ID |
textileCategory | TextileCategory | Auto-set based on product type |
TextileCategory Enum
| Value | Description | Default for |
|---|---|---|
YARN | Yarn products | YarnProduct |
FIBER | Fiber products | FiberProduct |
FABRIC | Fabric products | FabricProduct |
The textileCategory is automatically set via @PrePersist based on the concrete entity type. You can override it in the request, but the default is determined by getDefaultCategory().
Entity: YarnProduct
Yarns are continuous strands of fibers used in textile production, classified by count, twist, and ply.
| Field | Type | DB Column | Description |
|---|---|---|---|
yarnCount | Double | yarn_count | Yarn count (must be positive) |
yarnCountUnit | YarnCountUnit | yarn_count_unit | Unit of measurement for yarn count |
twist | String | twist | Twist direction, e.g. S, Z (max 10) |
ply | Integer | ply | Number of plies (≥ 0) |
yarnType | String | yarn_type | Type of yarn (max 100) |
YarnCountUnit Enum
| Value | Description |
|---|---|
NE | English cotton count |
NM | Metric count |
TEX | Tex (g per 1000m) |
DTEX | Decitex (g per 10000m) |
DENIER | Denier (g per 9000m) |
Entity: FiberProduct
Fibers are the raw material input for textile production, characterized by type, length, and fineness.
| Field | Type | DB Column | Description |
|---|---|---|---|
fiberType | String | fiber_type | Type of fiber, e.g. Cotton, Wool, Polyester (max 100) |
stapleLengthMm | Double | staple_length_mm | Staple length in mm (must be positive) |
finenessMicron | Double | fineness_micron | Fineness in microns (must be positive) |
fiberOrigin | String | fiber_origin | Geographic origin of the fiber (max 100) |
Entity: FabricProduct
Fabrics are woven or knitted textile products, described by width, weight, weave, and finish.
| Field | Type | DB Column | Description |
|---|---|---|---|
widthCm | Double | width_cm | Fabric width in cm (must be positive) |
arealMassGsm | Double | areal_mass_gsm | Areal mass in g/m² (must be positive) |
weaveType | String | weave_type | e.g. Plain, Twill, Satin, Jersey (max 100) |
finish | String | finish | e.g. Mercerized, Calendered, Brushed (max 100) |
Inherited BaseProduct Fields
All textile products inherit these fields from the base product model:
| Field | Type | Description |
|---|---|---|
name | String | Product name (required) |
code | String | Product code |
category / subcategory | String | Classification |
description | String | Product description |
technicalSpecs | String | Technical specifications |
composition | String | Material composition |
productOriginCountry | String | ISO 3166-1 alpha-2 (validated) |
rawMaterialOriginCountry | String | ISO 3166-1 alpha-2 (validated) |
unitOfMeasure | UnitOfMeasure | KG, METERS, PIECES, ROLLS |
quantityAvailable | Double | Current stock (≥ 0) |
leadTimeDays | Integer | Lead time in days (≥ 0) |
pricePerUnit | BigDecimal | Price per unit |
currency | String | ISO 4217 currency code |
minimumOrder | Double | Minimum order quantity |
productWeightKg | Double | Weight in kg |
| Certification booleans | Boolean | gotsCertified, grsCertified, oekoTexCertified, cradleToCradleCertified, betterCottonCertified |
recycledContentPercent | Double | % recycled content |
organicContentPercent | Double | % organic content |
sustainabilityNotes | String | Sustainability notes |
available | Boolean | Availability flag (default: true) |
metadata | Map<String, Object> | Custom JSON metadata |
createdAt / updatedAt | LocalDateTime | Auto-set timestamps |
API Reference
See Textile Products API → for endpoint details and examples.