【发布时间】:2018-01-05 23:25:02
【问题描述】:
当我尝试执行我的native query 时,我面临以下异常:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 你有一个 SQL 语法错误;检查与您对应的手册 MySQL 服务器版本,用于在 'f 附近使用正确的语法, codigoleyenda cl、tipocomprobante tc、moneda m、cliente c、tipotaxigv ttig, t' 在第 1 行
我的仓库如下-
@Repository
public interface FacturaRepository extends JpaRepository<Factura, Integer>, CrudRepository<Factura, Integer>{
@Query(value="select " +
"f.facId," +
"facBaja," +
"f.facEnvioSunat," +
"f.facEnvioServidor," +
"f.facEstadoEnvioCorreo," +
"f.facFechaRespuesta," +
"f.facRuta," +
"f.facSubTotal," +
"f.facInafecta," +
"f.facExonerada," +
"f.facGratuita," +
"f.facGravada," +
"f.facPercepcion," +
"f.facOtrosTributos," +
"f.facDescuento," +
"cl.codLeyCodigo," +
"f.facLeyenda," +
"f.facDetraccion," +
"f.facNroSerie," +
"f.facNroCorrelativo," +
"f.facFechaEmision," +
"tc.tipComCodigo,"+
"m.monCodigo,"+
"ub.ubiDepartamento," +
"ub.ubiProvincia," +
"ub.ubiDistrito," +
"ub.ubiCodigo," +
"p.parRuta," +
"s.sucDireccionFiscal," +
"s.sucRuc," +
"s.sucTipoDocumento," +
"s.sucPais," +
"s.sucRazonSocial," +
"c.cliCondicionDomicilio," +
"c.cliDireccionFiscal," +
"c.cliEstado," +
"c.cliNumeroDocumento," +
"c.cliRazonSocial," +
"td.tipDocCodigo," +
"f.facIgv," +
"f.facIsc," +
"ttig.tipTaxIgvCodigo," +
"ttis.tipTaxIscCodigo," +
"f.facOtrosConceptos," +
"oc.otrConCodigo," +
"f.facTaxIgvPorcentaje," +
"f.facTaxIscPorcentaje," +
"f.facHashcode," +
"f.facNombreZip," +
"f.facTotal," +
"f.facRetencion," +
"f.facPlaca" +
"from factura f, codigoleyenda cl, tipocomprobante tc, moneda m, cliente c, tipotaxigv ttig, tipotaxisc ttis, otrosconceptos oc," +
"tipodocumento td, sucursal s, ubigeo ub, parametros p" +
"where c.tipDocId = td.tipDocId and f.sucId=s.sucId and s.ubiId=ub.ubiId and s.parId=p.parId" +
"and f.codLeyId=cl.codLeyId and f.tipComId=tc.tipComId and f.monId=m.monId and f.cliId=c.cliId and " +
"f.tipTaxIgvId=ttig.tipTaxIgvId and f.tipTaxIscId=ttis.tipTaxIscId and f.OtrConId=oc.otrConId and f.facId=?1", nativeQuery=true)
FacturaXmlDto getFacturaXml(int facId);
此查询在 mysql 上运行良好,但遇到 SpringJPA 异常,我需要有关此问题的帮助。
【问题讨论】:
标签: java mysql sql spring spring-data-jpa