Forums de discussion

Service builder support for BETWEEN finders

thumbnail
Alan Boshier, modifié il y a 13 années.

Service builder support for BETWEEN finders

New Member Publications: 13 Date d'inscription: 21/01/11 Publications récentes
I'd like to set up a finder for my entity that maps down to a BETWEEN query e.g.

SELECT * FROM Foo WHERE Bar BETWEEN 2 AND 1110011

but attempting to define something akin to

[indent]<finder return-type="Collection" name="BarRange">
[indent]<finder-column name="Bar" comparator="&lt;"/>
<finder-column name="Bar" comparator="&gt;"/>[/indent]
</finder>
[/indent]

results in invalid Java being generated (as service builder maps each finder-column/@name to the finder method parameter name, and thus you end up with two parameters of the same name.

Using arrayable-operator="OR" doesn't seem appropriate here as the IN mechanism becomes very unwieldy where the range is large.

Aside from hand-crafting the SQL, is there anything else one can do?
thumbnail
Richard Gibson, modifié il y a 13 années.

RE: Service builder support for BETWEEN finders

Junior Member Publications: 30 Date d'inscription: 19/02/10 Publications récentes
Hi,

I'm no expert on this area, but could the dynamic query API help you here?

http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Queries+2%3A+DynamicQuery+API