You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by kr...@paxcel.net on 2012/05/01 14:19:57 UTC

Need to fetch records using multiple ids in where clause

Hi All,

I want to fetch products' details using multiple product ids in where clause 
so that there should be a single query for all the products to be shown in 
single page.
Similarly I want to fetch multiple products for multiple categories like at 
home page I am showing all the products of 3 different categories say mostly 
sold, mostly viewed, recently sold. So my concern is fetching all the data 
in one go instead of calling same query/service again and again.

Please let me know if such services already exist?


Thanks,
Krishan Babbar
----------------------------------------------------------------------------------------------------------------------------
Disclaimer: This email and any files transmitted with it may contain 
privileged or confidential information. It is solely for use by the 
individual for whom it is intended even if addressed incorrectly. If you 
received this email in error please notify the sender, do not disclose, 
copy, distribute or take any action in reliance on the contents of this 
information; and delete it from your system. Any other use of this email is 
prohibited. Thank you for your compliance.
 


Re: Need to fetch records using multiple ids in where clause

Posted by kr...@paxcel.net.
Great

Thanks,
Krishan Babbar
----------------------------------------------------------------------------------------------------------------------------
Disclaimer: This email and any files transmitted with it may contain 
privileged or confidential information. It is solely for use by the 
individual for whom it is intended even if addressed incorrectly. If you 
received this email in error please notify the sender, do not disclose, 
copy, distribute or take any action in reliance on the contents of this 
information; and delete it from your system. Any other use of this email is 
prohibited. Thank you for your compliance.
-----Original Message----- 
From: deb.panda@tcs.com
Sent: Wednesday, May 02, 2012 12:05 PM
To: user@ofbiz.apache.org
Cc: user@ofbiz.apache.org
Subject: RE: Need to fetch records using multiple ids in where clause

Sharing an experience....
findByCondition - is deprecated and hence not suggested. This might hit
performance later.

Food for thought --
findByAnd , findList are preferred to findByCondition.
Also condition can be made by EntityCondition - A static class of all the
condition may be used to be used later by all developers.

Dev


From:
"Skip" <sk...@thedevers.org>
To:
<us...@ofbiz.apache.org>
Date:
05/01/2012 10:04 PM
Subject:
RE: Need to fetch records using multiple ids in where clause



Try this:

                                 List productIds =
UtilMisc.toList("product1", "product2", etc);
            List productsList  = delegator.findByCondition("Product", new
EntityExpr("productId", EntityOperator.IN, productIds), null, null);

You can also use findByAnd

Skip

-----Original Message-----
From: krishan.babbar@paxcel.net [mailto:krishan.babbar@paxcel.net]
Sent: Tuesday, May 01, 2012 5:20 AM
To: user@ofbiz.apache.org
Subject: Need to fetch records using multiple ids in where clause


Hi All,

I want to fetch products' details using multiple product ids in where
clause
so that there should be a single query for all the products to be shown in
single page.
Similarly I want to fetch multiple products for multiple categories like
at
home page I am showing all the products of 3 different categories say
mostly
sold, mostly viewed, recently sold. So my concern is fetching all the data
in one go instead of calling same query/service again and again.

Please let me know if such services already exist?


Thanks,
Krishan Babbar
----------------------------------------------------------------------------
------------------------------------------------
Disclaimer: This email and any files transmitted with it may contain
privileged or confidential information. It is solely for use by the
individual for whom it is intended even if addressed incorrectly. If you
received this email in error please notify the sender, do not disclose,
copy, distribute or take any action in reliance on the contents of this
information; and delete it from your system. Any other use of this email
is
prohibited. Thank you for your compliance.





=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you



RE: Need to fetch records using multiple ids in where clause

Posted by de...@tcs.com.
Sharing an experience....
findByCondition - is deprecated and hence not suggested. This might hit 
performance later.

Food for thought --
findByAnd , findList are preferred to findByCondition.
Also condition can be made by EntityCondition - A static class of all the 
condition may be used to be used later by all developers.

Dev


From:
"Skip" <sk...@thedevers.org>
To:
<us...@ofbiz.apache.org>
Date:
05/01/2012 10:04 PM
Subject:
RE: Need to fetch records using multiple ids in where clause



Try this:

                                 List productIds = 
UtilMisc.toList("product1", "product2", etc);
            List productsList  = delegator.findByCondition("Product", new
EntityExpr("productId", EntityOperator.IN, productIds), null, null);

You can also use findByAnd

Skip

-----Original Message-----
From: krishan.babbar@paxcel.net [mailto:krishan.babbar@paxcel.net]
Sent: Tuesday, May 01, 2012 5:20 AM
To: user@ofbiz.apache.org
Subject: Need to fetch records using multiple ids in where clause


Hi All,

I want to fetch products' details using multiple product ids in where 
clause
so that there should be a single query for all the products to be shown in
single page.
Similarly I want to fetch multiple products for multiple categories like 
at
home page I am showing all the products of 3 different categories say 
mostly
sold, mostly viewed, recently sold. So my concern is fetching all the data
in one go instead of calling same query/service again and again.

Please let me know if such services already exist?


Thanks,
Krishan Babbar
----------------------------------------------------------------------------
------------------------------------------------
Disclaimer: This email and any files transmitted with it may contain
privileged or confidential information. It is solely for use by the
individual for whom it is intended even if addressed incorrectly. If you
received this email in error please notify the sender, do not disclose,
copy, distribute or take any action in reliance on the contents of this
information; and delete it from your system. Any other use of this email 
is
prohibited. Thank you for your compliance.





=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you



Re: Need to fetch records using multiple ids in where clause

Posted by kr...@paxcel.net.
Thanks Skip,



Krishan Babbar
----------------------------------------------------------------------------------------------------------------------------
Disclaimer: This email and any files transmitted with it may contain 
privileged or confidential information. It is solely for use by the 
individual for whom it is intended even if addressed incorrectly. If you 
received this email in error please notify the sender, do not disclose, 
copy, distribute or take any action in reliance on the contents of this 
information; and delete it from your system. Any other use of this email is 
prohibited. Thank you for your compliance.
-----Original Message----- 
From: Skip
Sent: Tuesday, May 01, 2012 9:59 PM
To: user@ofbiz.apache.org
Subject: RE: Need to fetch records using multiple ids in where clause

Try this:

List productIds = UtilMisc.toList("product1", "product2", etc);
            List productsList  = delegator.findByCondition("Product", new
EntityExpr("productId", EntityOperator.IN, productIds), null, null);

You can also use findByAnd

Skip

-----Original Message-----
From: krishan.babbar@paxcel.net [mailto:krishan.babbar@paxcel.net]
Sent: Tuesday, May 01, 2012 5:20 AM
To: user@ofbiz.apache.org
Subject: Need to fetch records using multiple ids in where clause


Hi All,

I want to fetch products' details using multiple product ids in where clause
so that there should be a single query for all the products to be shown in
single page.
Similarly I want to fetch multiple products for multiple categories like at
home page I am showing all the products of 3 different categories say mostly
sold, mostly viewed, recently sold. So my concern is fetching all the data
in one go instead of calling same query/service again and again.

Please let me know if such services already exist?


Thanks,
Krishan Babbar
----------------------------------------------------------------------------
------------------------------------------------
Disclaimer: This email and any files transmitted with it may contain
privileged or confidential information. It is solely for use by the
individual for whom it is intended even if addressed incorrectly. If you
received this email in error please notify the sender, do not disclose,
copy, distribute or take any action in reliance on the contents of this
information; and delete it from your system. Any other use of this email is
prohibited. Thank you for your compliance.



RE: Need to fetch records using multiple ids in where clause

Posted by Skip <sk...@thedevers.org>.
Try this:

		List productIds = UtilMisc.toList("product1", "product2", etc);
            List productsList  = delegator.findByCondition("Product", new
EntityExpr("productId", EntityOperator.IN, productIds), null, null);

You can also use findByAnd

Skip

-----Original Message-----
From: krishan.babbar@paxcel.net [mailto:krishan.babbar@paxcel.net]
Sent: Tuesday, May 01, 2012 5:20 AM
To: user@ofbiz.apache.org
Subject: Need to fetch records using multiple ids in where clause


Hi All,

I want to fetch products' details using multiple product ids in where clause
so that there should be a single query for all the products to be shown in
single page.
Similarly I want to fetch multiple products for multiple categories like at
home page I am showing all the products of 3 different categories say mostly
sold, mostly viewed, recently sold. So my concern is fetching all the data
in one go instead of calling same query/service again and again.

Please let me know if such services already exist?


Thanks,
Krishan Babbar
----------------------------------------------------------------------------
------------------------------------------------
Disclaimer: This email and any files transmitted with it may contain
privileged or confidential information. It is solely for use by the
individual for whom it is intended even if addressed incorrectly. If you
received this email in error please notify the sender, do not disclose,
copy, distribute or take any action in reliance on the contents of this
information; and delete it from your system. Any other use of this email is
prohibited. Thank you for your compliance.