0
votes

I am using LazyClob plugin in my Grails application in order to make field of domain class to be lazy-loaded. When I used String instead of LazyClob I could create query like this:

new DetachedCriteria(MyClass).build {
    ilike('myField', "%${content}%")
}

Is it possible to construct such Criteria query when LazyClob is used?

1

1 Answers

0
votes

You probably can, but you'd need to access the underlying real clob and then use the database-specific syntax for working with clobs in queries. For an example of how to do this in Oracle, see this other StackOverflow question. It's going to tend to be very inefficient though, especially of the clobs are large - it's unlikely that there's going to be any indexing active, so it will have to scan the entire string. If possible, try to store redundant strings in regular varchar columns for searching.