0

I have implemented a REST api using Wildfly 8.1. The endpoint is something like:

/rest/v1/users

In my implementation for every request I read users from the db and give back a json representation of the collection.

The strange think is that if I call the api I don't get a unique result for the collection (i.e., for each request it randomly provides one betweenn the older values and new values). This goes on until I restart the server.

The db interface is correct, so my guess is that Wildfly is caching the previous data, is it possible and why does it provides different results for different calls?

user601836
  • 3,215
  • 4
  • 38
  • 48
  • First of all, how are you retrieving your data from the DB? JPA, manual queries, using an order by clause, ...? Then, what do you mean by unique result for a collection, deterministic? And finally, what do you mean by older and new values? – shillner Jun 16 '14 at 18:40
  • the values are retrieved using manual queries (tested). Yes, I mean that the results are not the results in the db, but no results, previous results and current results at random – user601836 Jun 16 '14 at 19:36
  • Ok, please post some code samples, f.i. how you are querying the db. I don't think that there is any cache that delivers you some results when asking the db for entities. – shillner Jun 17 '14 at 06:31
  • There is no caching by default in wildfly do behave like this. I would look at your JPA configuration... – Tomaz Cerar Jun 17 '14 at 10:21
  • He doesn't use JPA. He said that he is using manual queries so that a caching behavior is even more unlikely than it would be when using JPA via Hibernate. – shillner Jun 17 '14 at 10:57
  • Hi, did you resolve the problem on your own? – shillner Jun 19 '14 at 06:46
  • no. I will try with a different version of wildfly – user601836 Jun 21 '14 at 12:03

0 Answers0