I am a PLM consultant interested in Open source projects. I am interested in
Ofbiz as a application framework, as well as the Fully flaged ERP system. I
have to say that it has a lot of great solutions (i.e. modularity and small
amount of code).
Please forgive me if my question will be stupid as I have downloaded the
Ofbiz sources today and I am quite new to the subject.
So lets go to the point:
In the line 96 (around, depending on svn version) of the class
CategoryWorker of the products component there is a line:
..
Collection<GenericValue> allCategories =
delegator.findList("ProductCategory", null, null, null, null, false);
..
Before I started to implement my solution using ofbiz I wanted to make some
test, especialy on large amounts of data.
So far I have got 1 000 000 categories in my database and after
selecing: Choose
Top Category <https://localhost:8443/catalog/control/ChooseTopCategory>action
from the catalog management I run out of memory (4 GB of Xmx).
I was considering why do we have to select all ( one milion!) records from
the database if we want to choose only several of them?
I have seen that you use PRODUCT_CATEGORY_ROLLUP table to keep the
parent-child relations between categories. I understand that there is a need
of having many to many relation.
But besides we also have Many to one relation: primary parent category -
child categories, shouldn't we consider those as well while selecting the
ROOT objects?
My solution was preaty trivial I have changed the line 96 in the mentioned
class to:
Collection<GenericValue> allCategories = delegator.findList
("ProductCategory",
EntityCondition.makeCondition("PRIMARY_PARENT_CATEGORY_ID", null), null,
null, null, false);
Is it a good solution? If it's not - I will find another way (some join
etc.), because from my point of view - selecting one milion objects if we
need a couple of them can be done by RDMS in almost realtime.
Please correct me if I am wrong. I can be wrong.
Best Regards,
MichaĆ Cukierman