Search in sources :

Example 1 with CollectionAttributesTestEntity

use of io.crnk.jpa.model.CollectionAttributesTestEntity in project crnk-framework by crnk-project.

the class BasicQueryTestBase method testEqualsInCollectionFilter.

@Test
public void testEqualsInCollectionFilter() {
    CollectionAttributesTestEntity entity = new CollectionAttributesTestEntity();
    entity.setId(13L);
    entity.setLongValues(Arrays.asList(1L, 2L));
    entity.setStringValues(Arrays.asList("John", "Doe"));
    em.persist(entity);
    assertEquals((Long) 13L, queryFactory.query(CollectionAttributesTestEntity.class).addFilter(CollectionAttributesTestEntity.ATTR_stringValues, FilterOperator.EQ, "Doe").buildExecutor().getUniqueResult(false).getId());
    assertEquals((Long) 13L, queryFactory.query(CollectionAttributesTestEntity.class).addFilter(CollectionAttributesTestEntity.ATTR_stringValues, FilterOperator.EQ, "John").buildExecutor().getUniqueResult(false).getId());
    assertNull(queryFactory.query(CollectionAttributesTestEntity.class).addFilter(CollectionAttributesTestEntity.ATTR_stringValues, FilterOperator.EQ, "Jane").buildExecutor().getUniqueResult(true));
}
Also used : CollectionAttributesTestEntity(io.crnk.jpa.model.CollectionAttributesTestEntity) Test(org.junit.Test)

Aggregations

CollectionAttributesTestEntity (io.crnk.jpa.model.CollectionAttributesTestEntity)1 Test (org.junit.Test)1