20030505 Monday May 05, 2003

Hibernate's Query by Criteria (What I'd like to see) After trying to work with Hibernate's new Query by Criteria feature in version 2.0, I've come up with a page detailing what I'd like to see. Basically, this page results from the API not working for my needs - and since it's still in its infancy, hopefully this document will help shape it future. I'll add a comments link on the document (to this post) for any feedback or comments. Posted in Java at May 05 2003, 03:56:12 PM MDT 2 Comments

Comments:

You can change this
<code> boolean msoFilter = (msoIds.contains(new Long(-1))) ? false : true; </code>
with
<code> boolean msoFilter = !(msoIds.contains(new Long(-1))); </code>
and same for headendFilter

Posted by Rouc1 on October 01, 2004 at 06:51 AM MDT #

!Matt, thanks for appfuse. Are you familiar with the Disjunction class in Hibernate? This may solve your issue. {{{ Criteria baseCriteria = session.createCriteria(Order.class); // // Add a case-insensitive search for any part of the first, mid, last name // Disjunction disjunction = Expression.disjunction(); disjunction.add(Expression.ilike("identifier", term, MatchMode.ANYWHERE)); disjunction.add(Expression.ilike("account.accountName", term, MatchMode.ANYWHERE)); disjunction.add(Expression.ilike("account.customer.customerName", term, MatchMode.ANYWHERE)); baseCriteria.add(disjunction); }}}

Posted by dan maher on December 01, 2004 at 03:21 PM MST #

Post a Comment:
  • HTML Syntax: Allowed