Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to get ViewObjectImpl of a detail VO?

GadoFeb 11 2019 — edited Feb 13 2019

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

Comments
Post Details
Added on Feb 11 2019
8 comments
170 views