Java Spring boot JPA nativeQuery@P0附近语法不正确

Java Spring boot JPA nativeQuery@P0附近语法不正确,java,sql,spring,hibernate,jpa,Java,Sql,Spring,Hibernate,Jpa,我试图使用Hibernate从spring boot应用程序运行以下查询,问题是在查询中我需要从方法中传递path变量 @质疑 value=插入dbo.images imageblobSELECT*FROM OPENROWSET BULK?,SINGLE_BLOB imageblol SELECT CASTscope_identity AS int;, nativeQuery=true 整数插入图像字符串路径; 我得到的错误是 com.microsoft.sqlserver.jdbc.SQLSe

我试图使用Hibernate从spring boot应用程序运行以下查询,问题是在查询中我需要从方法中传递path变量

@质疑 value=插入dbo.images imageblobSELECT*FROM OPENROWSET BULK?,SINGLE_BLOB imageblol SELECT CASTscope_identity AS int;, nativeQuery=true 整数插入图像字符串路径; 我得到的错误是

com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '@P0'.
如果我手动写入路径,它将工作

@质疑 value=插入dbo.images imageblobSELECT*从OPENROWSET BULK'C:\\pic\\NORMAL2-IM-1257-0001.jpeg',单个\u BLOB imageblol选择CASTscope\u identity作为int;, nativeQuery=true 整数插入图像字符串路径;
“@P0”是您的RowCountToDisplay参数。。。也许试着在论点周围加上括号

INSERT INTO dbo.images (imageblob)(SELECT * FROM OPENROWSET (BULK (?), SINGLE_BLOB) imageblol) SELECT CAST(scope_identity() AS int);"
             , nativeQuery = true)

这将返回com.microsoft.sqlserver.jdbc.SQLServerException:附近的语法不正确。请尝试更改方言。事实上,这就是问题所在。事实证明Hibernate并不支持所有方言