我正在尝试将SimpleJdbcInsert用于恰好在其名称中使用dbo作为默认架构的点字符的表。我传入了要插入的键值的映射。
insertMessage = new SimpleJdbcInsert(dataSource).withTableName("Trades.Transaction");
insertMessage.execute((Map)message);
出现以下异常:
PreparedStatementCallback; bad SQL grammar [INSERT INTO Trades.Transaction (Uid, StreamId, Version, ValidFrom, ValidTo, IsLatest, Direction, Quantity, Notional, TradeDate, Status, Action, SettlementAmount, SettlementCurrency, AccruedInterest, BookingAccountType, BookingAccountUid, BookingAccountName, BookingAccountLegalEntityId, BookingAccountLegalEntityShortName, BookingAccountRepUid, BookingAccountRepName, BookingAccountFacilitatorUid, BookingAccountFacilitatorName, BookingAccountFacilitatorTeamCode, ContraAccountType, ContraAccountUid, ContraAccountName, ContraAccountLegalEntityId, ContraAccountLegalEntityShortName, ContraAccountRepUid, ContraAccountRepName, ContraAccountFacilitatorUid, ContraAccountFacilitatorName, ContraAccountFacilitatorTeamCode, FacingAccountType, FacingAccountUid, FacingAccountName, FacingAccountLegalEntityId, FacingAccountLegalEntityShortName, FacingAccountRepUid, FacingAccountRepName, FacingAccountFacilitatorUid, FacingAccountFacilitatorName, FacingAccountFacilitatorTeamCode, OrigSystemIsElectronicChannel, OrigSystem, OrigSystemUid, OrigSystemStatus, OrigSystemType, OrigSystemVersion, OrigSystemErrors, DestSystemUid, DestSystem, DestSystemStatus, DestSystemType, DestSystemVersion, DestSystemErrors, StpSystemUid, StpSystem, StpSystemStatus, StpSystemType, StpSystemVersion, StpSystemErrors, GatewaySystem, GatewaySystemStatus, GatewaySystemType, GatewaySystemVersion, GatewaySystemErrors, SettlementSystemUid, SettlementSystemName, SettlementSystemStatus, SettlementSystemType, SettlementSystemVersion, SettlementSystemErrors, TransactionType, Price, Obligor, Receiver, QuoteDate, EffectiveDate, MaturityDate, UnitSize, MatchedStatus, MatchedTradeId, InstrumentDescription, BookingFacilitatorTeamCode, FxClientRate, Principal, AccruedDays, SalesCommissionCode, SalesCommissionAmount, SalesCommissionRate, SalesCommissionCcy, BrokerCommissionCode, BrokerCommissionAmount, BrokerCommissionRate, BrokerCommissionCcy, MarkupCommissionCode, MarkupCommissionAmount, MarkupCommissionRate, MarkupCommissionCcy, AddOnCommissionCode, AddOnCommissionAmount, AddOnCommissionRate, AddOnCommissionCcy, PhoneConfirmInd, PhoneConfirmBy, PhoneConfirmOn, SalesManagerReview, SalesManagerReviewComments, SalesManagerReviewTime, SalesManagerReviewIndicator, TradeManagerReview, TradeManagerReviewComments, TradeManagerReviewTime, TradeManagerReviewIndicator, EnteredOn, UpdatedOn, EnteredBy, GatewaySystemUid, OrigSystemNote1, OrigSystemNote2, OrigSystemNote3, DestSystemNote1, DestSystemNote2, DestSystemNote3, GatewayAllocFlag, QuotedAmount, LastModifiedBy, OrigTransactionId, OrigMarkitWireId, ContraAccountGlobalBook, BookingAccountGlobalBook, FXSettleAmount, SettlementLocation, AssignmentFeeCd, AssignmentFeeDesc, RiskFlagCd, RiskFlagDesc, FormPurchaseCd, FormPurchaseDesc, AccruedInterestCd, AccruedInterestDesc, EcnName, EcnId, ContraAccountLocation, BookingAccountLocation, isSuppressTrade, ContraAccountTradingSystem, BookingAccountTradingSystem, isAmend, RetailCommissionCode, RetailCommissionAmount, RetailCommissionRate, RetailCommissionCcy, ContraAccountADPAccountNo, AsOfTime, ClientCommission, MarketRate, DayCount, ExecutionStatus, LinkStreamId, Spread, RfqId, isWashGen, FxRateCurrencyPair, FxRateCalcMethod, isApprovedForNewIssueAllocation, TransactionReservationId, isEligibleForTradeSync) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; nested exception is java.sql.SQLException: Incorrect syntax near the keyword 'Transaction'.
我认为我需要一种方法用[]字符包围Trade.Transaction
,以便将其解释为完整的表名而不是schema.tableName
。但是,如果我在表名中指定那些,如下所示
insertMessage = new SimpleJdbcInsert(dataSource).withTableName("[Trades.Transaction]");
发生Spring异常,说明它无法找到元数据,因此找不到列名来生成insert语句。
有谁知道如何解决这个问题?
由于