You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Chandresh Turakhia <ch...@bhartitelesoft.com> on 2007/01/18 10:58:12 UTC

Fw: Ofbiz database interaction problem

Dear all.

How wise would be makes changes in the 
\framework\entity\src\org\ofbiz\entity\ code to implement "Connect by " 
clause .
Thinking of adding "parent" and "child" relation defined separetly in xsd 
and the generator writes CONNECT by clause

Nice if some one can point me if similiar stuff can be achieve by modelling 
using extensibility pattern. I think it should.

Where can i find more elobrate info on extensibility pattern. Please be 
request to pardon my ignorance.

Any pointers.


> Hi Chand,
>
> We have successfully implemented queries involving joins,
> operations(+,-,*,/) and functions(max,min,avg) by making view entities in
> entitymodel.xml.
> But still we have not found any solutions to following as far as database
> interactions are concerned.
>
> 1.How to write queries containing 'CONNECT BY PRIOR'?, for example 
> consider
> following
>
> SELECT U.user_id, U.user_name
> FROM users U
> WHERE U.status = 'Y' AND  U.network_code = ? AND U.category_code = 'DIST'
> AND UPPER(U.user_name) LIKE UPPER('%Singh%')
> CONNECT BY PRIOR U.user_id=U.parent_id START WITH U.user_id= 'ABC0001'
> ORDER BY U.user_name
>
> 2. How to write sql DECODES?For example consider following
>
> SELECT u.user_id, u.user_name FROM users u  ,users pu
> WHERE u.network_code = ? AND u.status = 'Y'  AND u.category_code = ? AND
> u.user_id != ?
> AND pu.parent_id = DECODE(pu.parent_id,'ROOT',pu.parent_id,?)
> AND u.parent_id = DECODE(pu.parent_id,'ROOT',?,u.parent_id)
> ORDER BY u.user_name
>
>
> 3. How to implement LEAST function in view entities as in SQL?
>
> 4. How to implement inner/sub queries or achieve the similar behaviour?
>
>
> Actually we are implementing a process of Pretups in ofbiz framework and
> above queries(and similar) are being used at lot of places in code.
>
> If possible please guide us.
>
>