0
當我們通過setParameter
設置marketOfferId
的值時,它不會返回結果。但是,當我用查詢中的單引號將實際值:marketOfferId
替換爲「BDEN3F」時。有人可以幫我嗎是什麼原因?JPA命名查詢未返回結果
String iden = "BDEN3F";
TypedQuery query = em.createNamedQuery(namedQuery,MarketingOfferWEB.class).setParameter("marketOfferId",iden);
- 不工作
@NamedNativeQuery(name = MarketingOfferWEB.FIND_WEB_MARKETOFFER, query = "SELECT * FROM VW_WEB_MKT_OFFERS WHERE MKT_OFFER_UID = :marketOfferId AND TENANT_ID=1", resultClass = MarketingOfferWEB.class)
- 工作
@NamedNativeQuery(name = MarketingOfferWEB.FIND_WEB_MARKETOFFER, query = "SELECT * FROM VW_WEB_MKT_OFFERS WHERE MKT_OFFER_UID = 'BDEN3F' AND TENANT_ID=1", resultClass = MarketingOfferWEB.class)