我得到了错误Exception in thread "main" org.springframework.dao.InvalidDataAccessApiUsageException: Parameter value [1] did not match expected type [java.lang.Boolean]; nested exception is java.lang.IllegalArgumentException: Parameter value [1] did not match expected type [java.lang.Boolean]
。
我对此感到困惑,因为它来自下面显示的被注释掉的服务方法。当我将其注释掉时,可以避免错误。该active
列是TINYINT(1)
要么1
要么0
。
实体:
@Entity
@NamedQueries({
@NamedQuery(name="Workflow.findByUUID", query="SELECT w FROM Workflow w WHERE w.uuid = :uuid"),
@NamedQuery(name="Workflow.findByActive", query="SELECT w FROM Workflow w WHERE w.active = :active ORDER BY id ASC")
})
我的仓库:
@Repository
public interface WorkflowRepository extends JpaRepository<Workflow, Integer> {
List<Workflow> findByActive(@Param("active") Integer active);
}
我的服务:
@Service
public class WorkflowService {
@Autowired
WorkflowRepository workflowRepository;
/**
* Get active workflows
*/
@Transactional(readOnly = true)
public List<Workflow> findActive() {
//return workflowRepository.findByActive(1);
return null;
}
当我取消注释时