[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3432?page=c...
]
Maxim Petrashev commented on HHH-3432:
--------------------------------------
Doesn't work under Oralce DB:
select * from ( select <sequence name>.nextval from dual ) where rownum <= 2
fails with error:
ORA-02287: sequence number not allowed here
query.uniqueResult() potentially generates out of memory by calling
list()
--------------------------------------------------------------------------
Key: HHH-3432
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3432
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.2.6, 3.3.0.CR2
Reporter: Emmanuel Bernard
calling list() while the user expects a single result has potential major flow: it's
easy to trigger an out of memory situation where nobody would expect it...
like getSingleResult("select CURRENT_TIME from
AN_ENTITY_CONTAINING_ZILLIONS_OF_RECORDS") ;
(and it is also a performance problem when it doesn't trigger the out of heap
space... and a design issue: why fetching something the caller is not asking for ? with
all the consequences on the cache...)
fix:
Something like that
if (maxResults != 1) query.setMaxResults( 2 ); //avoid OOME if the list is huge
List result = query.list();
if ( maxResults != -1 ) query.setMaxResults( maxResults ); //put back the original value
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira