Merge pull request #272 from beenokle/master

QueryDSL Collections failed to search by equality of Longs
This commit is contained in:
Timo Westkämper 2012-11-07 08:08:46 -08:00
commit 7ce2e5de59
2 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,23 @@
package com.mysema.query.collections;
import com.mysema.query.annotations.QueryEntity;
import com.mysema.query.annotations.QueryProjection;
@QueryEntity
public class EntityWithLongId {
private Long id;
@QueryProjection
public EntityWithLongId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}

View File

@ -0,0 +1,29 @@
package com.mysema.query.collections;
import org.junit.Assert;
import org.junit.Test;
import java.util.Arrays;
import java.util.List;
public class EntityWithLongIdTest {
private List<EntityWithLongId> entities = Arrays.asList(
new EntityWithLongId(999L),
new EntityWithLongId(1000L),
new EntityWithLongId(1001L),
new EntityWithLongId(1003L)
);
@Test
public void SimpleEquals() {
QEntityWithLongId root = QEntityWithLongId.entityWithLongId;
ColQuery query = new ColQueryImpl().from(root, entities);
query.where(root.id.eq(1000L));
Long found = query.singleResult(root.id);
Assert.assertNotNull(found);
Assert.assertEquals(found.longValue(), 1000);
}
}