Package org.springframework.data.jpa.repository.query.JpaQueryExecution

Examples of org.springframework.data.jpa.repository.query.JpaQueryExecution.ModifyingExecution


    } else if (method.isSliceQuery()) {
      return new SlicedExecution(method.getParameters());
    } else if (method.isPageQuery()) {
      return new PagedExecution(method.getParameters());
    } else if (method.isModifyingQuery()) {
      return method.getClearAutomatically() ? new ModifyingExecution(method, em) : new ModifyingExecution(method, null);
    } else {
      return new SingleEntityExecution();
    }
  }
View Full Code Here


    when(query.executeUpdate()).thenReturn(0);
    when(method.getReturnType()).thenReturn((Class) void.class);
    when(jpaQuery.createQuery(Mockito.any(Object[].class))).thenReturn(query);
    when(jpaQuery.getQueryMethod()).thenReturn(method);

    ModifyingExecution execution = new ModifyingExecution(method, em);
    execution.execute(jpaQuery, new Object[] {});

    verify(em, times(1)).clear();
  }
View Full Code Here

  @SuppressWarnings({ "unchecked", "rawtypes" })
  public void allowsMethodReturnTypesForModifyingQuery() throws Exception {

    when(method.getReturnType()).thenReturn((Class) void.class, (Class) int.class, (Class) Integer.class);

    new ModifyingExecution(method, em);
    new ModifyingExecution(method, em);
    new ModifyingExecution(method, em);
  }
View Full Code Here

  @SuppressWarnings({ "unchecked", "rawtypes" })
  @Test(expected = IllegalArgumentException.class)
  public void modifyingExecutionRejectsNonIntegerOrVoidReturnType() throws Exception {

    when(method.getReturnType()).thenReturn((Class) Long.class);
    new ModifyingExecution(method, em);
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.jpa.repository.query.JpaQueryExecution.ModifyingExecution

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.