我需要通过查询多个主键来获取多条记录。例如,从@Configuration
public class RibbonConfig {
@Value("${ribbon.OkToRetryOnAllOperations}")
private Boolean retryOnAllOperations;
@Value("${ribbon.MaxAutoRetries}")
private Integer maxAutoRetries;
@Value("${ribbon.MaxAutoRetriesNextServer}")
private Integer maxAutoRetriesNextServer;
@Bean
public RetryHandler retryHandler() {
IClientConfig clientConfig = DefaultClientConfigImpl
.Builder
.newBuilder()
.withMaxAutoRetries(maxAutoRetries)
.withMaxAutoRetriesNextServer(maxAutoRetriesNextServer)
.withRetryOnAllOperations(retryOnAllOperations)
.build();
RetryHandler retryHandler = new DefaultLoadBalancerRetryHandler(maxAutoRetries, maxAutoRetriesNextServer, retryOnAllOperations);
return new RequestSpecificRetryHandler(true, true, retryHandler, clientConfig );
}
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public IRule ribbonRule() {
return new RetryRule();
}
}
获取多个Employee
条记录
将Oracle DB
,EmployeeId
字段设置为基于多个主键EmployeeName
,这将导致employee_id = {1,2,3}
个记录,所有记录都在一个3 Employee
会话中。
我可以一个接一个地做到:
DB
此处Optional<EmployeeBean> eb = employeeRepo.findByEmployeeId(Id);
扩展了employeeRepo
是否可以使用CrudRepository<Employee, Long>
?
答案 0 :(得分:2)
使用//how can i return an array and delete an array?
int* classA :: aa(double* data, int length){
int* arr = new int[length];
for(int i=0; i<length; i++)
arr[i] = data[i];
// please look at this part
return arr;
delete[] arr;
}
。 Here是可以与spring data jpa一起使用的关键字列表。