You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Deyan Tsvetanov <de...@ittconsult.com> on 2010/05/01 18:34:55 UTC
Re: Question regarding Catalog management in Ofbiz
Actually it would be better to use EntityListIterator ( Delegator.find()
method ) instead of a List. Using a list would load 1,000,000 categories
into the heap which is not good :)
On Fri, 2010-04-30 at 04:30 -0700, BJ Freeman wrote:
> to address your basic concern the solution would be to load only the
> ID's instead of the complete data for each row.
> this is a minor change to the find call.
> give that a try.
> List<GenericValue> org.ofbiz.entity.Delegator.findList(String
> entityName, EntityCondition entityCondition, Set<String> fieldsToSelect,
> List<String> orderBy, EntityFindOptions findOptions, boolean useCache)
>
>
> =========================
> BJ Freeman
> http://bjfreeman.elance.com
> Strategic Power Office with Supplier Automation <http://www.businessesnetwork.com/automation/viewforum.php?f=93>
> Specialtymarket.com <http://www.specialtymarket.com/>
>
> Systems Integrator-- Glad to Assist
>
> Chat Y! messenger: bjfr33man
> Linkedin
> <http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>
>
>
> Michal Cukierman sent the following on 4/29/2010 12:30 PM:
> > 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
> >
>
>