Login  Register

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

Posted by natx on Feb 14, 2007; 7:50pm
URL: http://ofbiz.116.s1.nabble.com/using-GenericDelegator-what-is-the-MAX-functional-equivalent-tp178214.html

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