【发布时间】:2016-04-27 17:53:11
【问题描述】:
我有一个带有以下声明的存储过程:
CREATE PROCEDURE GetAttributesForCategory(IN catId BIGINT(20))
在我的 Spring Boot 支持的应用程序中有一个实体:
@Entity
@NamedStoredProcedureQueries({
@NamedStoredProcedureQuery(
name = "ProductAttribute.getAttributesForCategory",
procedureName = "GetAttributesForCategory",
parameters = {
@StoredProcedureParameter(name = "catId",
type = Long.class,
mode = ParameterMode.IN)
}
)
})
public class ProductAttribute {
...
}
对应的存储库看起来像:
public interface ProductAttributeReposirory extends JpaRepository<ProductAttribute, Long> {
@Procedure(name = "getAttributesForCategory")
List<ProductAttribute> getAttributesForCategory(@Param("catId") Long catId);
}
都是按照this example做的,但是在Spring上下文加载过程中出现异常:
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'productAttributeRepository': Invocation of init method failed;
nested exception is org.springframework.data.mapping.PropertyReferenceException:
No property getAttributesForCategory found for type ProductAttribute!
我无法想象出了什么问题。有人可以吗?
【问题讨论】:
标签: jpa stored-procedures spring-data spring-data-jpa