I have this code:
Types.tryblock({ () -> Void in
let queryOptions = QueryOptions()
queryOptions.relationsDepth = 0;
queryOptions.pageSize = 20
queryOptions.offset = queryOptions.pageSize.integerValue * page
queryOptions.sortBy(["created desc"])
queryOptions.related = ["challenge", "challenge.topPhotograph", "image"]; // Load the challenge as well
let dataQuery = BackendlessDataQuery()
dataQuery.queryOptions = queryOptions;
dataQuery.whereClause = "owner.objectId = '\(user.objectId)'"
Backendless.sharedInstance().persistenceService.find(Photograph.ofClass(), dataQuery: dataQuery, response: { (collection : BackendlessCollection!) -> Void in
success(photos: collection.data as! [Photograph])
}, error: { (fault : Fault!) -> Void in
print(fault.message)
failure()
})
},
catchblock: { (exception) -> Void in
print("(FAULT): \(exception as! Fault)")
failure()
})
Gettings this error:
java.lang.RuntimeException: java.lang.RuntimeException: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'created' in order clause is ambiguous