【发布时间】:2018-01-19 10:59:38
【问题描述】:
我打算写一个类似的查询方法
/**
* TODO Auto-generated method documentation
*
* @param entity
* @return EventExecute
*/
@Transactional
@Autowired
public EventExecute save(EventExecute entity) {
String eventKey = entity.getEventKey();
StepDefinitionRepository sdRepository;
List<StepDefinition> stepDefinitions = sdRepository.findByEventKeyAllIgnoreCaseOrderBySequenceAsc(eventKey);
return getEventExecuteRepository().save(entity);
}
我想查找与事件键匹配的 StepDefintions。
我尝试按照 JPA 文档中的示例进行操作...
public class SomeClient {
@Autowired
private PersonRepository repository;
public void doSomething() {
List<Person> persons = repository.findByLastname("Matthews");
}
}
但是我的 sdRepository 抱怨它没有初始化。我在 ..ServiceImpl.aj 中找到了 getStepDefintionRepository() 但无法调用它。
有例子吗?
【问题讨论】:
-
那不是“JPA 文档”,而是“Spring Data JPA 文档”。 Spring Data JPA API!= JPA API。标签固定
标签: java spring-data-jpa spring-roo