I have used lightweight pattern because my table have a large BLOB field.
Now i have Normative class with only non BLOB fields and NormativeBody that extends Normative and add a property for the BLOB (String body).
Now i want to perform a query to retrieve normatives so
NormativaBody normative = ....;
...
String bodyToMatch = normative.getBody();
normative.setBody(null);
Criteria criteria = session.createCriteria(NormativaBody.class);
criteria.add(Example(normative));
criteria.add(Expression.like("body", bodyToMatch, MatchMode.ANYWHERE);
..
It would return a collection of NormativeBody with all the fileds (also body) initialized, and i don't want this because it would be too memory consuming if items retrieved will be enough!
How can i obtain Normative objects with this approach?
|