Hello,
I need to create a jsp that shows a group of orders that contains a product.
Is there any way to make this using some api function?
Thanks.
Vpod
Well, I figured it out.
I'll share the solution with you. it may be usefull for someone else:
KKWSAdminIf adm = new KKWSAdminIfServiceLocator().getKKWSAdmin();
List<AdminOrder> ordenes = new ArrayList<AdminOrder>();
List<Record> records;
try {
Torque.init("torque.properties");
records = BasePeer
.executeQuery("select orders_id, products_id " +
"from orders_products " +
"where products_id = " + products_id);
if (records != null) {
for (Iterator<Record>
iterator = records.iterator();
iterator.hasNext();)
{
Record rec = (Record) iterator.next();
int orders_id = rec.getValue(1).asInt();
AdminOrder orden = adm.getOrderForOrderId(sessionId, orders_id);
ordenes.add(orden);
}
}
} catch (TorqueException e) {
e.printStackTrace();
} catch (DataSetException e) {
e.printStackTrace();
}