ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chandrabhan Pal <chandrabhan....@vnnogile.in>
Subject Re: How to use Raw sql query in ofbiz
Date Thu, 20 Sep 2018 08:42:38 GMT
Hello Madhi,

You can try external connection to database ,find below reference code.

                     Connection connection = 
                    //Below I have written sql on order_item entity
                     String rawSQLQuery= "select 
product_id,count(product_id),item_description, sum(quantity*unit_price) 
as item_value from order_item"+
                     " where created_stamp between 'startDate' and 
                     "group by item_description, product_id"+
                     " order by item_value desc limit 10";

                     String rawSQLQuery1 = rawSQLQuery;

                     PreparedStatement ps = 
                     ResultSet rs = ps.executeQuery();
                     while (rs.next()) {
                        //put you logic here with resultSet data
catch(Exception e){
//Handle Exception

On 9/20/2018 1:18 PM, Madhi Krishnan wrote:
> Hey all can anyone please tell me how to use raw sql query in ofbiz..
> If you have any sources or example it will be better..
> Thank You

  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message