REST - Initialization Form - best way to get last BDO?

1
0
-1

What's the best practice method to get the most recent (previous) BDO into the Initialization Form?

JPQL is short of many functions, not least get 1 record

Select Top 1 * from table t order by t.somekey

I've tried

Select t from table t where t.persistenceId = MAX(t.persistenceId)

which fails on the aggregate function MAX()

Having to create a false data variable, passing it to the form and then calling REST doesn't make sense just to get the last record...

We would rather just call getLastRecord and be done with it.

Anyone got a best practice for this?

Thanks and regards
Seán

1 answer

1
+1
-1
This one is the BEST answer!

You can take advantage of the p and c parameter of the REST API. p is the page number and c is the number of results per page.

If you combine a request like :

SELECT t FROM table t ORDER BY t.somekey DESC

And you call it with p and c :

/API/bdm/businessData/businessDataType?q=queryName&p=0&c=1

You should be able to retrieve the object with the higher somekey.

Comments

Submitted by Sean McP on Sat, 04/16/2016 - 05:34

So obvious, but JPQL should be able to do this...

Notifications