How to obtain a recently added row from a fixed table, which satisfies a certain position.
If I use javax / persistence / Query.html # getSingleResult (), then we get a non-exclusive result exception, if there are several rows to complete the query. I need a search from the list, I do not like to set rowsPerPage as 1st and do not have Pagegram and then I get it as a result.
You indicated that you do not want to use "rowsPerPage", but it's a reasonable The method is:
query.setMaxResults (1)
However, it does not guarantee that the row is most recent, as long as you Do not query for criteria including dates. If you do not have such a column, and you are not using auto-environments (which should be the last resort), then you can not achieve your goal.
Comments
Post a Comment