If the model class does not contain a creation_time field, is it possible to retrieve the latest created object?
Suppose there is an Address class which contains a number of String fields and no creation date. If a user created an address1 yesterday and then he creates another address today, how do I retrieve the one created today? I think django has a way to do this by means of pk of the record in db.
Something like
Model.objects.latest('pk')
Is there a similar facility in playframework?
If you make an assumption (ie, ensure) that the id is sequential then you can do something like this:
This should retrieve the first entry when sorted by ID which should be the most recent entry. As play uses hibernate/JPA you may find a better answer if you ask this question as a generic JPA/Hibernate question.