Vijay,
No problem. In BSH scripts, you can use the DynamicViewEntity or even the <view-entity>. Bear in
mind that BSH scripts (in OFBiz's case) is actually Java. Whatever is possible in Java (almost
whatever) is also possible in BSH scripts. In BSH scripts, you can even do some "classes" and
method encapsulation and code organization, much like what you can do in Java. (I haven't fully
tested classes and scope, though).
The DynamicaViewEntity, GenericDelegator, GenericValue, etc, those can be used to access the
database. Even your need for grouping and summary data is served.
Just about everything JDBC can do, the EntityEngine can do, I'd say. All the way down to DISTINCT
values, ResultSet type (scroll_sensitive, scroll_insensitive, etc) even.
Jonathon
vijay Si wrote:
No there is no seca involved, also i wanted to know that ones i use view
entities then can i access the retrieved results from the database in the
bsh script, as i need to have those reusults in bsh script.
On 9/16/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
In my testing, there is an approximate 20msec hit using the entity engine
over raw jdbc, depending of course on the query, is there a seca involved,
etc.
Skip
-----Original Message-----
From: vijay Si [mailto:[EMAIL PROTECTED]
Sent: Saturday, September 15, 2007 10:28 AM
To: [email protected]
Subject: Re: Accessing database through bsh script.
Jonathon
It seems that other option left is to use a jdbc connection to database.
Is
it also imperative then, that for very complex querries having
"groupby"..."having" and other clauses it is better to use jdbc method of
connection.
How does it affect the ofbiz philosophy of architecture if i use jdbc for
executing these querries. As right now i cannot find any ways of
implementing those aggregate functions(sum,min,max...) through Entity
Engine
(without creating views). Also do you have any idea of performance
behaviour
on using jdbc connection?
Thanks.
On 9/15/07, Jonathon -- Improov <[EMAIL PROTECTED]> wrote:
There's no other (easy) way to query database, aside from using the
Entity
Engine (which was what
I suggested).
If you're worried about performance hit with a huge (and unconditional)
cross-product, see
http://www.nabble.com/forum/ViewPost.jtp?post=12590081&framed=y and
https://issues.apache.org/jira/browse/OFBIZ-1232
Jonathon
vijay Si wrote:
Hi Jonathon,
i cannot use the view-entity for querrying, as it would cause a
performance
hit. Is there any other method to get the above querry. Do u know of
any
ways to do it through bsh script.
Regards
On 9/15/07, Jonathon -- Improov <[EMAIL PROTECTED]> wrote:
Use the GenericDelegator and related classes, I think. Or maybe not.
I
can't recall the aggregate
functions there.
The entity definitions do have those, though. The <view-entity>? Oh
yes,
the <view-entity>.
Try using DynamicViewEntity to construct a <view-entity>.
Jonathon
vijay Si wrote:
Is there any funtionality provided for using aggregate functions
(sum,min,max..) and count() for querrying to data base through bsh.
for egg: how can we write following in BSH :
Select sum(order_id),sum(grand_total) from order_header where
order_type_id="PURCHASE_ORDER";
Regards
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.487 / Virus Database: 269.13.19/1008 - Release Date:
9/14/2007 8:59 AM
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.487 / Virus Database: 269.13.19/1008 - Release Date:
9/14/2007 8:59 AM
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.487 / Virus Database: 269.13.21/1010 - Release Date: 9/15/2007 7:54 PM