2014-02-21 72 views
0

我使用Hibernate執行以下查詢,並且在位置2和3中返回的對象數組具有相同的值,因爲在DB中這些值不同。數據庫是Oracle,Hibernate的版本是3.2.6。這種情況只發生在生產環境中,一個特定的客戶(使用WebSphere),在dev和其他客戶中工作正常。Hibernate返回一個數組返回重複的列

String sql = " SELECT acc.account_code," + 
      "  acct.description, " + 
      "  (SELECT SUM(item_amount)" + 
      "   FROM gem_book_entry_item bi, gem_document d" + 
      "   WHERE account_id = acc.dboid AND " + 
      "    account_sign = 1 AND " + 
      "    bi.document_id = d.dboid AND " + 
      "    d.state_id = :definitive AND " + 
      "    (d.internal_reference IS NULL OR d.internal_reference NOT IN (:references)) AND " + 
      "    d.posting_approval_date <= :refDate" + 
      "  ) ," + 
      "  (SELECT SUM(item_amount)" + 
      "   FROM gem_book_entry_item bi, gem_document d" + 
      "   WHERE account_id = acc.dboid AND " + 
      "    account_sign = -1 AND " + 
      "    bi.document_id = d.dboid AND " + 
      "    d.state_id = :definitive AND " + 
      "    (d.internal_reference IS NULL OR d.internal_reference NOT IN (:references)) AND " + 
      "    d.posting_approval_date <= :refDate" + 
      "  ) ," + 
      "  acc.init_balance" + 
      " FROM gem_account acc, gem_account_t acct " + 
      " WHERE acc.dboid = acct.dboid AND " + 
      "  acc.institution_id = :institutionId AND " + 
      "  acc.period_code = :periodCode AND " + 
      "  acct.lang = :langId " ; 
+0

您是否手動在PROD上運行查詢? – Vitaly

+0

是的,我做了,它的工作,但使用使用Oracle客戶端的C++客戶端。我想這是JDBC驅動程序的錯誤。 –

回答