mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-13 21:01:01 +08:00
Merge pull request #272 from beenokle/master
QueryDSL Collections failed to search by equality of Longs
This commit is contained in:
commit
7ce2e5de59
@ -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;
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user