-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: criteria problems
PostPosted: Thu Nov 04, 2004 1:13 pm 
Regular
Regular

Joined: Tue Oct 12, 2004 9:02 am
Posts: 66
Location: Italy
I like to use QBE here because it is elegant and very readable, but i also have this problem. NormativaBody and Normativa implement the lightweight pattern, and NormativaBody has the blob field.
I want search in normatives by Normativa fields but also by text in blob field of NormativaBody. So the source code i would like should be similar to:
public Collection searchByFields(NormativaBody normativa)
throws InfrastructureException {
Collection norms = null;

String body = normativa.getBody();
normativa.setBody(null);

try {
Session session = HibernateUtil.currentSession();

Criteria criteria = session.createCriteria(NormativaBody.class);
criteria.add(Example.create(normativa));

if (body != null) {
criteria.add(Expression.ilike("body", body, MatchMode.ANYWHERE));
}

criteria.list();
} catch (HibernateException ex) {
throw new InfrastructureException(ex);
}

normativa.setBody(body);

return norms;
}
But this can't work because field "body" is not know by Normativa.hbn.xml mapping file. And i use Normativa instead of NormativaBody to avoid hibernate get me normatives with the large blob field initialized.

Any suggestion?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.