Search in sources :

Example 1 with RepositoryMethodPrefix

use of org.apache.deltaspike.data.impl.meta.RepositoryMethodPrefix in project deltaspike by apache.

the class CdiQueryContextHolderTest method dummyRepoMethod.

private RepositoryMethodMetadata dummyRepoMethod(RepositoryMetadata metadata) {
    RepositoryMethodMetadata methodMetadata = new RepositoryMethodMetadata(dummyMethod());
    methodMetadata.setMethodPrefix(new RepositoryMethodPrefix(metadata.getRepositoryClass().getAnnotation(Repository.class).methodPrefix(), dummyMethod().getName()));
    return methodMetadata;
}
Also used : Repository(org.apache.deltaspike.data.api.Repository) SimpleRepository(org.apache.deltaspike.data.test.service.SimpleRepository) RepositoryMethodMetadata(org.apache.deltaspike.data.impl.meta.RepositoryMethodMetadata) RepositoryMethodPrefix(org.apache.deltaspike.data.impl.meta.RepositoryMethodPrefix)

Example 2 with RepositoryMethodPrefix

use of org.apache.deltaspike.data.impl.meta.RepositoryMethodPrefix in project deltaspike by apache.

the class QueryRootTest method should_use_alternative_prefix.

@Test
public void should_use_alternative_prefix() {
    // given
    final String name = "fetchByName";
    final String expected = "select e from Simple e " + "where e.name = ?1";
    // when
    String result = QueryRoot.create(name, repoFetchBy, new RepositoryMethodPrefix("fetchBy", name)).getJpqlQuery().trim();
    // then
    assertEquals(expected, result);
}
Also used : RepositoryMethodPrefix(org.apache.deltaspike.data.impl.meta.RepositoryMethodPrefix) Test(org.junit.Test)

Aggregations

RepositoryMethodPrefix (org.apache.deltaspike.data.impl.meta.RepositoryMethodPrefix)2 Repository (org.apache.deltaspike.data.api.Repository)1 RepositoryMethodMetadata (org.apache.deltaspike.data.impl.meta.RepositoryMethodMetadata)1 SimpleRepository (org.apache.deltaspike.data.test.service.SimpleRepository)1 Test (org.junit.Test)1