Creating Inventories
When creating new Inventory
and other types of records via the API we only want to provide the id
of referenced entities.
In the example below, we would create a new Inventory
for accession with id: 2001
:
{
"accession": {
"id": 2001
},
"inventoryMaintPolicy": {
"id": 2
},
"site": {
"id": 47
},
"distributionCriticalQuantity": 1600,
"distributionDefaultFormCode": "SD",
"distributionDefaultQuantity": 250,
"distributionUnitCode": "sd",
"formTypeCode": "SD",
"isAutoDeducted": "Y",
"maintenanceName": "Maize",
"note": null,
"quantityOnHandUnitCode": "sd",
"regenerationCriticalQuantity": 1600,
"regenerationMethodCode": "Pap",
"inventoryNumberPart1": "MO",
"inventoryNumberPart2": "-1",
"isDistributable": "Y",
"quantityOnHand": "5000",
"hundredSeedWeight": "500",
"isAvailable": "Y",
"availabilityStatusCode": "AVAIL"
}
Right now, this fails in lazyLoad
because accession.taxonomySpecies == null
.
@Transactional
boundaries don't allow for this.
The create
service methods need to load these referenced entities.