我一直在尝试调用我使用jpa创建的函数,但我一直收到此错误
(org.eclipse.persistence.exceptions.DatabaseException 内部异常:com.microsoft.sqlserver.jdbc.SQLServerException:'udf_searchEmployeeLeaves'不是公认的内置函数名称。 错误代码:195)
val toolbox = currentMirror.mkToolBox()
val code1 =
q"""
//we need to import all sql types
import org.apache.spark.sql.types._
StructType(
//StructType needs list
List(
//name arguments need to be in proper quotes
StructField("id",IntegerType,true),
StructField("name",StringType,true),
StructField("tstamp",TimestampType,true),
StructField("date",DateType,true)
)
)
"""
val sType = toolbox.compile(code1)().asInstanceOf[StructType]
println(sType)
答案 0 :(得分:0)
我认为电话不正确。
您必须像这样调用表函数:
Query query = em.createNativeQuery("SELECT * FROM udf_searchEmployeeLeaves(?1)");