Here's the mapping file:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class
name="com.mmi.intouch.model.Issue"
table="issue">
<id
name="id"
column="issue_id"
type="java.lang.Integer"
unsaved-value="null">
<generator class="increment" />
</id>
<property
name="escalate"
type="yes_no"
update="true"
insert="true"
column="escalate"
/>
...
and the Issue class:
Code:
public class Issue extends BaseObject {
private Integer id;
private Boolean escalate = true;
public Boolean getEscalate() {
return escalate;
}
public void setEscalate(Boolean escalate) {
this.escalate = escalate;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
...
}
I am creating the query like this:
Code:
Example ex = Example.create(issue).excludeZeroes().ignoreCase().enableLike(MatchMode.ANYWHERE);
Criteria c = session.createCriteria(Issue.class).add(ex);
return c.list();
Here is the hibernate generated SQL:
Code:
select [...] from issue this_ inner join citizen citizen1_ on this_.citizen_id=citizen1_.citizen_id inner join street_type streettype2_ on citizen1_.loc_street_type_id=streettype2_.street_type_id where (1=1) and this_.escalate=? and (1=1) and (streettype2_.abbreviation=?) and this_.created>? and this_.created<?
[InTouch] DEBUG [main] NullableType.nullSafeSet(59) | binding 'true' to parameter: 1
[InTouch] DEBUG [main] NullableType.nullSafeSet(59) | binding 'RD' to parameter: 2
[InTouch] DEBUG [main] NullableType.nullSafeSet(52) | binding null to parameter: 3
[InTouch] DEBUG [main] NullableType.nullSafeSet(52) | binding null to parameter: 4
Thanks!