给定以下带注释的命名存储过程查询:
@NamedStoredProcedureQueries({
@NamedStoredProcedureQuery(
name = "procedureName",
procedureName = "stored_procedure"
)
})
然后执行:
StoredProcedureQuery query = entityManager.createNamedStoredProcedureQuery("procedureName");
query.executeUpdate();
stored_procedure返回postgres void.
结果异常:由以下原因引起:org.hibernate.MappingException:JDBC类型的No Dialect映射:1111
.
如何解决?
解决方法:
@sqlresultsetmapping(
name = "VOID_MAPPING",
classes = {
@ConstructorResult(targetClass = VoidClass.class, columns = {})
}
)
将resultSetMappings添加到@NamedStoredProcedureQuery.
resultSetMappings = {
"VOID_MAPPING"
}
VoidClass只是一个空类.
public class VoidClass {}