I have the following class and need to manually increment the nextId field.
class SomeIdClass {
Family family
Integer nextId = 0
long timeCreated = new Date().time }
So far I've been trying to retrieve and the latest db entry to increment it and I'm just not having any luck with that. Or am I just going about it in a totally wrong manner?
Thaks
ps: this is what I tried but get a list of Package.SomeId objects
def si = SomeId.executeQuery(" from SomeId where nextId = (select max( nextId ) from SomeId) ")
My two cents for return the last row in Grails:
DomainClass.find("from DomainClass order by id desc")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With