Cast String Column to Long grails createCriteria
<p>I have a domain class in grails which has a column of string type. Below is the domain class structure.</p>

<pre><code>class TravelRequestUpdates{
        updatedAt sqlType:'varchar(40)'

String updatedAt


}
</code></pre>

<p>I store epoch dates in this column. Using createCriteria i want to perform a between check on this column for long type values but am unable to do so. Is there a way i can store values in this column as String and still perform Long type operation on the values stored. Below is the code for my criteria where i want that the values stored in this table to behave as long type. The dates are not being compared.</p>

<pre><code>              def criteriaObj = TravelRequestUpdates.createCriteria()

def travelToShow = criteriaObj.get{

                    @Formula("cast(updatedAt as NUMBER(20,0))")
                    long tempUpdatedAt

                    tr{
                      eq('id',g.id)
                    }
                    and{
                      between(tempUpdatedAt, startTimeReport.time, endTimeReport.time)
                    }
                    and{
                      newStatus{
                        eq('id',completedTravelsStatus.id)
                      }
                    }
                  }
</code></pre>

<p>I want to generate a query like the one below. The below query gives me the desired result.</p>

<pre><code>SELECT *
FROM travel_request_updates
WHERE tr_id = '439'
AND updated_at BETWEEN ('1478016321000') AND('1478189121000')
AND new_status_id = '4'
</code></pre>