Hello,
I am using JDev 11.1.1.7.0.
I have two linked view objects, The master is WarehouseVO and the detail is WareInventoryVO.
WarehouseVO represents the warehouse itself, WareInventoryVO represents the Products stock in the Warehouse.
WarehouseVO has (WareId primary key, Warehouse Name)
WareInventoryVO has (WareId as foreign key, ProdId, Qnty)
The requirement is to decrease the stock of a Product
Since they are both linked together i can have all Products stock in each Warehouse, But i want to filter WareInventoryVO by ProdId also to get all records for a certain Product in a warehouse.
So i created a view criteria to filter WareInventoryVO using ProdId.
To get the records of a product i use this code:
Warehouses_VORowImpl warehouse =(Warehouses_VORowImpl)getUserBranchesWarehouses().findByKey(new Key(new Object[] {wareId}),1)[0];
WareInventory_VOImpl inventory = (WareInventory_VOImpl)warehouse.getWareInventory();
ViewCriteria vc = inventory.getViewCriteria("getProdInventory_VC");
inventory.applyViewCriteria(vc);
inventory.setP_prodId(prodId);
inventory.executeQuery();
Problem is i am getting an error at the red line because warehouse.getWareInventory() returns RowIterator which can't be cast to a ViewObjectImpl.
So how can i get a ViewObjectImpl of a detail from a master VO?
Thank you
Gado