0

I am writing an OData Producer in Java using odata4j. The Producer provides feeds of data from a legacy database.

I'm trying to find out how I implement paging and caching in my OData Producer.

I see lots of examples using .NET where you can set the SetEntitySetPageSize and use CachePolicy on the URLs including the Query filters, but can't see any equivalents in the Java world.

So how do I implement this in Java? Or do I have to provide the full data feed all the time?

Thanks.

Sarah

Sarah Rushworth
  • 813
  • 3
  • 9
  • 16

1 Answers1

0

for what concerns paging you can use the $skip option in your request. For example, odata4j producers limit by default the number of entities in a response to 50. So, if you ask for *http://your_producer_url/your_entity_set* you'll have the first 50 entities, if you ask for *http://your_producer_url/your_entity_set?$skip=50* you'll have the entities from the 51st to the 100th and so on. In other words, paging is already implemented in the odata4j library. For what concerns caching I don't know if the odata4j producers already implements it, if not I guess there is no other way but to implement it directly in your code. HTH

Marco

user1187008
  • 482
  • 3
  • 10