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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

natx
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
Reply | Threaded
Open this post in threaded view
|

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

Jacques Le Roux
Administrator
Please use user ML for that kind of questions,

Jacques

----- Original Message -----
From: "natx" <[hidden email]>
To: <[hidden email]>
Sent: Wednesday, February 14, 2007 8:50 PM
Subject: 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--tf3229256.html#a8972100
> Sent from the OFBiz - Dev mailing list archive at Nabble.com.