En Attachment
dominio añadir nuevo campo Long fileBytesLength
y dentro del cierre del mapeo agregue la fórmula para calcular la longitud de fileBytes
campo.
class Attachment {
String createUserName
String originalFilename
byte[] fileBytes
Long fileBytesLength
Date dateCreated
//Other Properties
static mapping = {
//Other mappings
fileLength formula: "dbms_lob.getlength(fileBytes)"
}
}
Y luego modifique la consulta a:
def results = Attachment.executeQuery(
'select id, originalFilename, fileBytesLength, dateCreated, createUserName '+
'from Attachment a where a.id not in '+
'(select attachmentId from SpecVersion sv where sv.attachmentId is not null) '+
'and a.dateCreated > sysdate - 30')