我用Hibernate执行以下查询,并且返回的对象数组在位置2和3中具有相同的值,而在DB中这些值是不同的。数据库是Oracle,Hibernate是3.2.6版。这只发生在生产和特定客户(使用WebSphere),在开发和其他客户中工作正常。
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 " ;