[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4787) AuditProperty.isNull() doesn't generate "tab.col is null" SQL clause as expected
Eric Citaire (JIRA)
noreply at atlassian.com
Wed Jan 13 17:04:35 EST 2010
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=35216#action_35216 ]
Eric Citaire commented on HHH-4787:
-----------------------------------
This single test fail :
(tested in org.hibernate.envers.test.integration.query.SimpleQuery integration test)
{noformat}
@Test
public void testEntitiesIsNullQuery() {
EntityManager em = getEntityManager();
em.getTransaction().begin();
StrIntTestEntity site = new StrIntTestEntity(null, 10);
em.persist(site);
Integer id = site.getId();
em.getTransaction().commit();
StrIntTestEntity ver = (StrIntTestEntity) getAuditReader().createQuery()
.forEntitiesAtRevision(StrIntTestEntity.class, 2)
.add(AuditEntity.id().eq(id))
.add(AuditEntity.property("str1").isNull())
.getSingleResult();
assert ver.equals(new StrIntTestEntity(null, 10, id2));
}
{noformat}
> AuditProperty.isNull() doesn't generate "tab.col is null" SQL clause as expected
> --------------------------------------------------------------------------------
>
> Key: HHH-4787
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4787
> Project: Hibernate Core
> Issue Type: Bug
> Components: envers
> Affects Versions: 3.3.0.GA
> Environment: Hibernate 3.3.0.GA, Envers 1.2.2, HSQLDB Database
> Reporter: Eric Citaire
> Priority: Critical
>
> AuditProperty.isNull() generate a SQL condition like this :
> "tab.col=?"
> where the bind variable is mapped to a null value.
> This doesn't work : most database engines will return false in every case.
> It should use the "is null" test instead :
> "tab.col is null"
> http://en.wikipedia.org/wiki/SQL#Null_and_Three-Valued_Logic_.283VL.29
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list