You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by natx <na...@theladders.com> on 2007/02/15 16:21:27 UTC

using GenericDelegator: what is the MAX() functional equivalent?

Hey everybody. I hope this is an appropriate question for this particular
branch of the forum. 

Basically, I have a few Ofbiz entities set up which point to tables in a
MySQL database. These tables all have a numeric field called "id" which acts
as the primary key (established using the <prim-key field="id"/construct).
I'd like to have these id fields populated with a numeric sequence generator
which insures uniqueness. 

I'm pretty new to Ofbiz, so the first thing I did was look for a way to do
this manually by using the equivalent to the MAX function in SQL to find the
next number in the sequence. However, I wasn't able to find any use of the
MAX function, unless I wanted to create a View Entity (which seems
unnecessary). So my first question is: is there any equivalent to the MAX
function when using the GenericDelegator to run database queries? 

Note: I just discovered the existence of the getNextSeqId() method in
GenericDelegator. Since there is an entity called "SequenceValueItem" in our
entity model, I'm assuming that this will serve my purpose. But my first
question still stands. Thanks! 

-- Nate 
-- 
View this message in context: http://www.nabble.com/using-GenericDelegator%3A-what-is-the-MAX%28%29-functional-equivalent--tf3234318.html#a8987232
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: using GenericDelegator: what is the MAX() functional equivalent?

Posted by "David E. Jones" <jo...@hotwaxmedia.com>.
Nate,

Check out the view-entity and DynamicViewEntity stuff in the Entity  
Engine (the Entity Engine Guide has some details on these). These  
support sets of fields with group by and functions for aggregated data.

-David


On Feb 15, 2007, at 8:21 AM, natx wrote:

>
> Hey everybody. I hope this is an appropriate question for this  
> particular
> branch of the forum.
>
> Basically, I have a few Ofbiz entities set up which point to tables  
> in a
> MySQL database. These tables all have a numeric field called "id"  
> which acts
> as the primary key (established using the <prim-key field="id"/ 
> construct).
> I'd like to have these id fields populated with a numeric sequence  
> generator
> which insures uniqueness.
>
> I'm pretty new to Ofbiz, so the first thing I did was look for a  
> way to do
> this manually by using the equivalent to the MAX function in SQL to  
> find the
> next number in the sequence. However, I wasn't able to find any use  
> of the
> MAX function, unless I wanted to create a View Entity (which seems
> unnecessary). So my first question is: is there any equivalent to  
> the MAX
> function when using the GenericDelegator to run database queries?
>
> Note: I just discovered the existence of the getNextSeqId() method in
> GenericDelegator. Since there is an entity called  
> "SequenceValueItem" in our
> entity model, I'm assuming that this will serve my purpose. But my  
> first
> question still stands. Thanks!
>
> -- Nate 
> -- 
> View this message in context: http://www.nabble.com/using- 
> GenericDelegator%3A-what-is-the-MAX%28%29-functional-equivalent-- 
> tf3234318.html#a8987232
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>